Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for PR: Added required_user_groups for client get, add and update #129

Merged
merged 4 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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