From 9a8e9ad2b7e50bed45e0496a5e8d3cd98835b538 Mon Sep 17 00:00:00 2001 From: Markus Strehle <11627201+strehle@users.noreply.github.com> Date: Tue, 21 Nov 2023 07:26:21 +0100 Subject: [PATCH] Tests for PR: Added required_user_groups for client get, add and update (#129) * comment not needed * test * some more tests coverage should be ok with that --- lib/uaa/cli/client_reg.rb | 1 - spec/client_reg_spec.rb | 13 ++++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/uaa/cli/client_reg.rb b/lib/uaa/cli/client_reg.rb index e3b73ae..30b9937 100644 --- a/lib/uaa/cli/client_reg.rb +++ b/lib/uaa/cli/client_reg.rb @@ -165,7 +165,6 @@ def update_client(cr, info) end def add_meta_fields_to_client(cr, client, id = nil) - # when attrs for get does not contain client_id, client does not have client_id, therefore i have added id if id == nil id = client['client_id'] end diff --git a/spec/client_reg_spec.rb b/spec/client_reg_spec.rb index 591eb22..417f5f5 100644 --- a/spec/client_reg_spec.rb +++ b/spec/client_reg_spec.rb @@ -86,16 +86,27 @@ module CF::UAA Cli.run("client jwt delete #{@test_client} ").should be end + it "fails to get client" do + Cli.run("token client get #{@test_client} -s #{@test_secret}").should be + Cli.run("context #{@admin_client}").should be + Cli.run("client get #{@test_client}").should be + Cli.run("client get #{@test_client} -a id").should be + Cli.output.string.should include 'id' + Cli.run("client get not-existing").should be_nil + Cli.output.string.should include 'NotFound' + end + context 'as updated client' do before :all do # update the test client as the admin client Cli.run("token client get #{@test_client} -s #{@test_secret}").should be Cli.run("context #{@admin_client}").should be - Cli.run("client update #{@test_client} --authorities scim.write,scim.read").should be + Cli.run("client update #{@test_client} --authorities scim.write,scim.read --required_user_groups openid").should be Cli.output.string.should include 'created_by' Cli.run("client get #{@test_client}").should be Cli.output.string.should include 'scim.read', 'scim.write' + Cli.output.string.should include 'required_user_groups' end it 'fails to create a user account with old token' do