cf-uaac 3.5.0 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,88 +23,89 @@ describe ClientCli do
23
23
  before :all do
24
24
  #Util.default_logger(:trace)
25
25
  @output = StringIO.new
26
- Cli.configure("", nil, @output, true)
27
- setup_target(authorities: "scim.read,clients.secret", grant_types: "client_credentials")
28
- @test_user, @test_pwd = "sam_#{Time.now.to_i}", "correcthorsebatterystaple"
26
+ Cli.configure('', nil, @output, true)
27
+ setup_target(authorities: 'scim.read,clients.secret', grant_types: 'client_credentials')
28
+ @test_user, @test_pwd = "sam_#{Time.now.to_i}", 'correcthorsebatterystaple'
29
29
  end
30
30
 
31
31
  after :all do cleanup_target end
32
32
 
33
- it "registers a new client" do
33
+ it 'registers a new client' do
34
34
  @test_client.should be # actually registered in the before :all block
35
35
  end
36
36
 
37
- it "gets a client registration" do
37
+ it 'gets a client registration' do
38
38
  Cli.run("client get #{@test_client}").should be
39
39
  Cli.output.string.should include @test_client
40
+ Cli.output.string.should include 'created_by'
40
41
  end
41
42
 
42
- it "lists client registrations" do
43
- Cli.run("clients").should be
43
+ it 'lists client registrations' do
44
+ Cli.run('clients').should be
44
45
  Cli.output.string.should include @admin_client, @test_client
45
46
  end
46
47
 
47
- context "as test client" do
48
+ context 'as test client' do
48
49
 
49
50
  before :all do
50
51
  Cli.run("token client get #{@test_client} -s #{@test_secret}").should be
51
52
  end
52
53
 
53
- it "logs in as test client" do
54
- Cli.run("context").should be # login was in before :all block
54
+ it 'logs in as test client' do
55
+ Cli.run('context').should be # login was in before :all block
55
56
  Cli.output.string.should include @test_client
56
57
  Cli.output.string.should match /access_token: \S+?\s+token_type/m
57
58
  end
58
59
 
59
- it "does not wrap the output of the access token in the terminal" do
60
+ it 'does not wrap the output of the access token in the terminal' do
60
61
  @output.stub(:tty?) { true }
61
62
  HighLine::SystemExtensions.stub(:terminal_size) { [80] }
62
- Cli.run("context").should be
63
+ Cli.run('context').should be
63
64
  Cli.output.string.should match /access_token: \S+?\s+token_type/m
64
65
  end
65
66
 
66
67
  it "changes it's client secret" do
67
68
  Cli.run("token client get #{@test_client} -s #{@test_secret}").should be
68
- Cli.run("token decode").should be
69
+ Cli.run('token decode').should be
69
70
  Cli.run("secret change --old_secret #{@test_secret} --secret newclientsecret").should be
70
71
  Cli.run("token client get #{@test_client} -s newclientsecret").should be
71
72
  Cli.run("secret change --old_secret newclientsecret -s #{@test_secret}").should be
72
73
  Cli.run("token client get #{@test_client} -s #{@test_secret}").should be
73
74
  end
74
75
 
75
- it "fails to create a user account as test client" do
76
+ it 'fails to create a user account as test client' do
76
77
  Cli.run("user add #{@test_user} -p #{@test_pwd}").should be_nil
77
- Cli.output.string.should include "access_denied"
78
+ Cli.output.string.should include 'access_denied'
78
79
  end
79
80
 
80
- context "as updated client" do
81
+ context 'as updated client' do
81
82
 
82
83
  before :all do
83
84
  # update the test client as the admin client
84
85
  Cli.run("token client get #{@test_client} -s #{@test_secret}").should be
85
86
  Cli.run("context #{@admin_client}").should be
86
87
  Cli.run("client update #{@test_client} --authorities scim.write,scim.read").should be
88
+ Cli.output.string.should include 'created_by'
87
89
  Cli.run("client get #{@test_client}").should be
88
- Cli.output.string.should include "scim.read", "scim.write"
90
+ Cli.output.string.should include 'scim.read', 'scim.write'
89
91
  end
90
92
 
91
- it "fails to create a user account with old token" do
93
+ it 'fails to create a user account with old token' do
92
94
  Cli.run("context #{@test_client}").should be
93
95
  Cli.run("user add #{@test_user} -p #{@test_pwd}").should be_nil
94
- Cli.output.string.should include "access_denied"
96
+ Cli.output.string.should include 'access_denied'
95
97
  end
96
98
 
97
- it "creates a user account with a new token" do
99
+ it 'creates a user account with a new token' do
98
100
  Cli.run("context #{@test_client}").should be
99
101
  Cli.run("token client get #{@test_client} -s #{@test_secret}").should be
100
- Cli.run("token decode")
102
+ Cli.run('token decode')
101
103
  Cli.run("user add #{@test_user.capitalize} -p #{@test_pwd} --email #{@test_user}@example.com --family_name #{@test_user.capitalize} --given_name joe").should be
102
- Cli.output.string.should_not include "access_denied"
104
+ Cli.output.string.should_not include 'access_denied'
103
105
  Cli.run("user get #{@test_user}").should be
104
106
  Cli.output.string.should include @test_user.capitalize
105
107
  end
106
108
  end
107
-
108
109
  end
109
110
 
110
111
  # context "as admin client" do
@@ -118,5 +119,4 @@ describe ClientCli do
118
119
  # end
119
120
 
120
121
  end
121
-
122
122
  end
data/spec/spec_helper.rb CHANGED
@@ -75,6 +75,7 @@ module SpecHelper
75
75
  "--authorized_grant_types #{opts[:grant_types]} " +
76
76
  "--autoapprove #{opts[:autoapprove]} " +
77
77
  "--signup_redirect_url #{opts[:signup_redirect_url]}").should be
78
+ Cli.output.string.should include 'created_by'
78
79
  opts.each { |k, a| Util.arglist(a).each {|v| Cli.output.string.should include(v) }}
79
80
  @test_client = test_client
80
81
  end
data/spec/user_spec.rb CHANGED
@@ -22,15 +22,15 @@ describe UserCli do
22
22
 
23
23
  before :all do
24
24
  #Util.default_logger(:trace)
25
- Cli.configure("", nil, StringIO.new, true)
26
- setup_target(authorities: "clients.read,scim.read,scim.write")
25
+ Cli.configure('', nil, StringIO.new, true)
26
+ setup_target(authorities: 'clients.read,scim.read,scim.write')
27
27
  Cli.run("token client get #{@test_client} -s #{@test_secret}").should be
28
- Config.yaml.should include("access_token")
29
- @test_pwd = "TesTpwd$%^"
28
+ Config.yaml.should include('access_token')
29
+ @test_pwd = 'TesTpwd$%^'
30
30
  @test_user = "tEst_UseR_#{Time.now.to_i}"
31
31
  Cli.run("user add #{@test_user} -p #{@test_pwd} " +
32
- "--emails sam@example.com,joNES@sample.com --given_name SamueL " +
33
- "--phones 801-555-1212 --family_name jonES").should be
32
+ '--emails sam@example.com,joNES@sample.com --given_name SamueL ' +
33
+ '--phones 801-555-1212 --family_name jonES').should be
34
34
  end
35
35
 
36
36
  after :all do
@@ -38,12 +38,12 @@ describe UserCli do
38
38
  cleanup_target
39
39
  end
40
40
 
41
- it "creates a user" do
42
- Cli.output.string.should include "success"
41
+ it 'creates a user' do
42
+ Cli.output.string.should include 'success'
43
43
  end
44
44
 
45
45
  it "fails to change a user's password with the wrong old pwd" do
46
- Cli.run("password change -p newpwd --old_password not-the-password").should be_nil
46
+ Cli.run('password change -p newpwd --old_password not-the-password').should be_nil
47
47
  end
48
48
 
49
49
  it "changes a user's password" do
@@ -52,25 +52,39 @@ describe UserCli do
52
52
  Cli.run("token get #{@test_user} newpwd").should be
53
53
  Cli.run("password change -p #{@test_pwd} -o newpwd").should be
54
54
  Cli.run("token get #{@test_user} #{@test_pwd}").should be
55
- Cli.output.string.should include "Successfully fetched token"
55
+ Cli.output.string.should include 'Successfully fetched token'
56
56
  end
57
57
 
58
- it "preserves case in names" do
58
+ it 'preserves case in names' do
59
59
  Cli.run("context #{@test_client}")
60
60
  Cli.run("user get #{@test_user.upcase}").should be
61
61
  Cli.output.string.should =~ /#{@test_user}/
62
62
  end
63
63
 
64
- it "unlocks a user" do
65
- Cli.run("user add user-1 -p password-1 " +
66
- "--emails user-1@example.com --given_name user1 " +
67
- "--phones 801-555-2431 --family_name jonES")
68
- Cli.run("user unlock user-1")
69
- Cli.output.string.should include "success"
70
- Cli.run("user delete user-1")
64
+ it 'unlocks a user' do
65
+ Cli.run('user add user-1 -p password-1 ' +
66
+ '--emails user-1@example.com --given_name user1 ' +
67
+ '--phones 801-555-2431 --family_name jonES')
68
+ Cli.run('user unlock user-1')
69
+ Cli.output.string.should include 'success'
70
+ Cli.run('user delete user-1')
71
71
  end
72
72
 
73
- describe "get list of users" do
73
+ it 'deactivates a user' do
74
+ Cli.run("user deactivate #{@test_user}")
75
+ Cli.output.string.should include 'user account successfully deactivated'
76
+ Cli.run("user get #{@test_user}")
77
+ Cli.output.string.should include 'active: false'
78
+ end
79
+
80
+ it 'activates a user' do
81
+ Cli.run("user activate #{@test_user}")
82
+ Cli.output.string.should include 'user account successfully activated'
83
+ Cli.run("user get #{@test_user}")
84
+ Cli.output.string.should include 'active: true'
85
+ end
86
+
87
+ describe 'get list of users' do
74
88
  before :all do
75
89
  i = 1
76
90
  count = 15
@@ -91,20 +105,20 @@ describe UserCli do
91
105
  end
92
106
  end
93
107
 
94
- it "gets users with default pagination" do
95
- Cli.run("users")
96
- Cli.output.string.should include "user-1"
97
- Cli.output.string.should include "user-2"
98
- Cli.output.string.should include "user-14"
108
+ it 'gets users with default pagination' do
109
+ Cli.run('users')
110
+ Cli.output.string.should include 'user-1'
111
+ Cli.output.string.should include 'user-2'
112
+ Cli.output.string.should include 'user-14'
99
113
  # Default page size for stub uaa is 15
100
- Cli.output.string.should_not include "user-15"
114
+ Cli.output.string.should_not include 'user-15'
101
115
  end
102
116
 
103
- it "gets count users with pagination" do
104
- Cli.run("users --start 1 --count 3")
105
- Cli.output.string.should include "user-1"
106
- Cli.output.string.should include "user-2"
107
- Cli.output.string.should_not include "user-3"
117
+ it 'gets count users with pagination' do
118
+ Cli.run('users --start 1 --count 3')
119
+ Cli.output.string.should include 'user-1'
120
+ Cli.output.string.should include 'user-2'
121
+ Cli.output.string.should_not include 'user-3'
108
122
  end
109
123
  end
110
124
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cf-uaac
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0
4
+ version: 3.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Syer
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-12-20 00:00:00.000000000 Z
15
+ date: 2017-01-28 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: bundler
@@ -104,14 +104,14 @@ dependencies:
104
104
  requirements:
105
105
  - - "~>"
106
106
  - !ruby/object:Gem::Version
107
- version: 3.7.0
107
+ version: 3.8.0
108
108
  type: :runtime
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
111
111
  requirements:
112
112
  - - "~>"
113
113
  - !ruby/object:Gem::Version
114
- version: 3.7.0
114
+ version: 3.8.0
115
115
  - !ruby/object:Gem::Dependency
116
116
  name: highline
117
117
  requirement: !ruby/object:Gem::Requirement