Skip to content

Commit

Permalink
Tests for PR: Added required_user_groups for client get, add and upda…
Browse files Browse the repository at this point in the history
…te (#129)

* comment not needed

* test

* some more tests
coverage should be ok with that
  • Loading branch information
strehle authored Nov 21, 2023
1 parent 4736244 commit 9a8e9ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion lib/uaa/cli/client_reg.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 12 additions & 1 deletion spec/client_reg_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9a8e9ad

Please sign in to comment.