From a47b82ae39b648ba364a3a0b7d3bfacc13f839a1 Mon Sep 17 00:00:00 2001 From: Lennart Kuijs Date: Wed, 26 Mar 2025 16:48:23 +0100 Subject: [PATCH 1/7] support for team based roles --- spec/client_spec.rb | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/spec/client_spec.rb b/spec/client_spec.rb index cd4f87b..b55a8b9 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -127,6 +127,19 @@ def loop_times(times) expect(response['users']).to include user[:id] end + it 'creates a user with team and teams_role' do + user = { + id: SecureRandom.uuid, + team: 'blue', + teams_role: { 'blue' => 'admin' } + } + response = @client.update_user(user) + expect(response).to include 'users' + expect(response['users']).to include user[:id] + expect(response['users'][user[:id]]['team']).to eq 'blue' + expect(response['users'][user[:id]]['teams_role']['blue']).to eq 'admin' + end + it 'updates multiple users' do users = [{ id: SecureRandom.uuid }, { id: SecureRandom.uuid }] response = @client.update_users(users) @@ -151,6 +164,22 @@ def loop_times(times) expect(response['users'][user_id]['field']).to eq('updated') end + it 'makes partial user update with team and teams_role' do + user_id = SecureRandom.uuid + @client.update_user({ id: user_id, name: 'Test User' }) + + response = @client.update_user_partial({ + id: user_id, + set: { + team: 'blue', + teams_role: { 'blue' => 'admin' } + } + }) + + expect(response['users'][user_id]['team']).to eq('blue') + expect(response['users'][user_id]['teams_role']['blue']).to eq('admin') + end + it 'deletes a user' do response = @client.delete_user(@random_user[:id]) expect(response).to include 'user' From ab98af0eb6b8cb8609b7a2e1960369801cec4342 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Wed, 26 Mar 2025 16:52:01 +0100 Subject: [PATCH 2/7] Update spec/client_spec.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- spec/client_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/client_spec.rb b/spec/client_spec.rb index b55a8b9..8b634b0 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -169,7 +169,7 @@ def loop_times(times) @client.update_user({ id: user_id, name: 'Test User' }) response = @client.update_user_partial({ - id: user_id, + id: user_id, set: { team: 'blue', teams_role: { 'blue' => 'admin' } From db5f996f913563d0d13a43e12e419630a6d37698 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Wed, 26 Mar 2025 16:52:07 +0100 Subject: [PATCH 3/7] Update spec/client_spec.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- spec/client_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/client_spec.rb b/spec/client_spec.rb index 8b634b0..07c41a2 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -174,7 +174,7 @@ def loop_times(times) team: 'blue', teams_role: { 'blue' => 'admin' } } - }) + }) expect(response['users'][user_id]['team']).to eq('blue') expect(response['users'][user_id]['teams_role']['blue']).to eq('admin') From 75540ccab0965f32e128627b28c3d8e3c38d323d Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Wed, 26 Mar 2025 16:53:06 +0100 Subject: [PATCH 4/7] Update spec/client_spec.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- spec/client_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/client_spec.rb b/spec/client_spec.rb index 07c41a2..34fb6f7 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -170,7 +170,7 @@ def loop_times(times) response = @client.update_user_partial({ id: user_id, - set: { + set: { team: 'blue', teams_role: { 'blue' => 'admin' } } From 41fbb3a9f8c44f06861270e970617183d17babca Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Wed, 26 Mar 2025 16:54:25 +0100 Subject: [PATCH 5/7] Update spec/client_spec.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- spec/client_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/client_spec.rb b/spec/client_spec.rb index 34fb6f7..97b04d6 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -171,7 +171,7 @@ def loop_times(times) response = @client.update_user_partial({ id: user_id, set: { - team: 'blue', + team: 'blue', teams_role: { 'blue' => 'admin' } } }) From b8f7ad8292e2d0857c1316fb08cd6b671f29a4f8 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Wed, 26 Mar 2025 16:54:33 +0100 Subject: [PATCH 6/7] Update spec/client_spec.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- spec/client_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/client_spec.rb b/spec/client_spec.rb index 97b04d6..7dd12f6 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -173,7 +173,7 @@ def loop_times(times) set: { team: 'blue', teams_role: { 'blue' => 'admin' } - } + } }) expect(response['users'][user_id]['team']).to eq('blue') From 86beb825f58dff1945492110b95e8504fd4a3429 Mon Sep 17 00:00:00 2001 From: Lennart <1247198+totalimmersion@users.noreply.github.com> Date: Wed, 26 Mar 2025 16:55:31 +0100 Subject: [PATCH 7/7] Update spec/client_spec.rb Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- spec/client_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/client_spec.rb b/spec/client_spec.rb index 7dd12f6..3d68f0e 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -172,7 +172,7 @@ def loop_times(times) id: user_id, set: { team: 'blue', - teams_role: { 'blue' => 'admin' } + teams_role: { 'blue' => 'admin' } } })