stormpath-sdk 1.6.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +21 -0
- data/CHANGES.md +11 -0
- data/README.md +23 -25
- data/lib/stormpath-sdk.rb +11 -2
- data/lib/stormpath-sdk/api_key.rb +0 -1
- data/lib/stormpath-sdk/auth/basic_authenticator.rb +7 -7
- data/lib/stormpath-sdk/auth/basic_login_attempt.rb +7 -11
- data/lib/stormpath-sdk/auth/create_factor.rb +1 -1
- data/lib/stormpath-sdk/auth/register_service_provider.rb +41 -0
- data/lib/stormpath-sdk/auth/username_password_request.rb +3 -5
- data/lib/stormpath-sdk/cache/cache.rb +3 -3
- data/lib/stormpath-sdk/cache/cache_entry.rb +2 -2
- data/lib/stormpath-sdk/cache/cache_manager.rb +3 -4
- data/lib/stormpath-sdk/cache/cache_stats.rb +1 -3
- data/lib/stormpath-sdk/cache/disabled_cache_store.rb +5 -8
- data/lib/stormpath-sdk/cache/memory_store.rb +1 -1
- data/lib/stormpath-sdk/cache/redis_store.rb +4 -4
- data/lib/stormpath-sdk/client.rb +35 -33
- data/lib/stormpath-sdk/data_store.rb +278 -257
- data/lib/stormpath-sdk/error.rb +18 -7
- data/lib/stormpath-sdk/http/authc/sauthc1_signer.rb +76 -82
- data/lib/stormpath-sdk/http/http_client_request_executor.rb +10 -8
- data/lib/stormpath-sdk/http/response.rb +5 -7
- data/lib/stormpath-sdk/id_site/id_site_result.rb +5 -6
- data/lib/stormpath-sdk/oauth/access_token_authentication_result.rb +5 -9
- data/lib/stormpath-sdk/oauth/authenticator.rb +2 -2
- data/lib/stormpath-sdk/oauth/error.rb +4 -4
- data/lib/stormpath-sdk/oauth/id_site_grant_request.rb +1 -1
- data/lib/stormpath-sdk/oauth/password_grant_request.rb +1 -1
- data/lib/stormpath-sdk/oauth/refresh_grant_request.rb +2 -2
- data/lib/stormpath-sdk/oauth/stormpath_grant_request.rb +2 -2
- data/lib/stormpath-sdk/provider/account_access.rb +0 -2
- data/lib/stormpath-sdk/provider/account_result.rb +1 -2
- data/lib/stormpath-sdk/provider/facebook/facebook_provider.rb +6 -2
- data/lib/stormpath-sdk/provider/facebook/facebook_provider_data.rb +7 -3
- data/lib/stormpath-sdk/provider/github/github_provider.rb +6 -2
- data/lib/stormpath-sdk/provider/github/github_provider_data.rb +6 -2
- data/lib/stormpath-sdk/provider/google/google_provider.rb +7 -3
- data/lib/stormpath-sdk/provider/google/google_provider_data.rb +6 -2
- data/lib/stormpath-sdk/provider/linkedin/linkedin_provider.rb +6 -2
- data/lib/stormpath-sdk/provider/linkedin/linkedin_provider_data.rb +6 -2
- data/lib/stormpath-sdk/provider/provider.rb +8 -4
- data/lib/stormpath-sdk/provider/provider_data.rb +6 -2
- data/lib/stormpath-sdk/provider/saml/saml_provider.rb +10 -4
- data/lib/stormpath-sdk/provider/saml/saml_provider_data.rb +6 -3
- data/lib/stormpath-sdk/provider/stormpath/stormpath_provider.rb +6 -2
- data/lib/stormpath-sdk/provider/stormpath/stormpath_provider_data.rb +6 -2
- data/lib/stormpath-sdk/provider/twitter/twitter_provider.rb +6 -2
- data/lib/stormpath-sdk/provider/twitter/twitter_provider_data.rb +6 -2
- data/lib/stormpath-sdk/resource/account.rb +46 -40
- data/lib/stormpath-sdk/resource/account_link.rb +9 -5
- data/lib/stormpath-sdk/resource/account_linking_policy.rb +8 -4
- data/lib/stormpath-sdk/resource/account_membership.rb +1 -1
- data/lib/stormpath-sdk/resource/account_overrides.rb +20 -16
- data/lib/stormpath-sdk/resource/account_store.rb +15 -11
- data/lib/stormpath-sdk/resource/account_store_mapping.rb +14 -13
- data/lib/stormpath-sdk/resource/application.rb +147 -136
- data/lib/stormpath-sdk/resource/application_web_config.rb +11 -7
- data/lib/stormpath-sdk/resource/associations.rb +36 -43
- data/lib/stormpath-sdk/resource/attribute_statement_mapping_rules.rb +8 -0
- data/lib/stormpath-sdk/resource/base.rb +201 -200
- data/lib/stormpath-sdk/resource/challenge.rb +12 -8
- data/lib/stormpath-sdk/resource/collection.rb +77 -76
- data/lib/stormpath-sdk/resource/custom_data.rb +60 -61
- data/lib/stormpath-sdk/resource/custom_data_hash_methods.rb +28 -25
- data/lib/stormpath-sdk/resource/custom_data_storage.rb +18 -16
- data/lib/stormpath-sdk/resource/directory.rb +37 -60
- data/lib/stormpath-sdk/resource/email_verification_token.rb +7 -3
- data/lib/stormpath-sdk/resource/error.rb +8 -4
- data/lib/stormpath-sdk/resource/expansion.rb +22 -20
- data/lib/stormpath-sdk/resource/factor.rb +12 -8
- data/lib/stormpath-sdk/resource/field.rb +8 -4
- data/lib/stormpath-sdk/resource/group.rb +21 -16
- data/lib/stormpath-sdk/resource/group_membership.rb +7 -5
- data/lib/stormpath-sdk/resource/instance.rb +10 -6
- data/lib/stormpath-sdk/resource/linked_account.rb +7 -3
- data/lib/stormpath-sdk/resource/oauth_policy.rb +7 -3
- data/lib/stormpath-sdk/resource/organization.rb +14 -10
- data/lib/stormpath-sdk/resource/organization_account_store_mapping.rb +8 -4
- data/lib/stormpath-sdk/resource/password_reset_token.rb +9 -5
- data/lib/stormpath-sdk/resource/phone.rb +8 -4
- data/lib/stormpath-sdk/resource/registered_saml_service_provider.rb +8 -0
- data/lib/stormpath-sdk/resource/saml_identity_provider.rb +14 -0
- data/lib/stormpath-sdk/resource/saml_identity_provider_metadata.rb +9 -0
- data/lib/stormpath-sdk/resource/saml_policy.rb +10 -0
- data/lib/stormpath-sdk/resource/saml_service_provider.rb +7 -0
- data/lib/stormpath-sdk/{provider/saml/saml_mapping_rules.rb → resource/saml_service_provider_metadata.rb} +6 -5
- data/lib/stormpath-sdk/resource/saml_service_provider_registration.rb +11 -0
- data/lib/stormpath-sdk/resource/schema.rb +8 -4
- data/lib/stormpath-sdk/resource/tenant.rb +11 -8
- data/lib/stormpath-sdk/resource/user_info_mapping_rules.rb +7 -3
- data/lib/stormpath-sdk/resource/utils.rb +7 -10
- data/lib/stormpath-sdk/resource/verification_email.rb +7 -3
- data/lib/stormpath-sdk/resource/x_509_certificate.rb +7 -0
- data/lib/stormpath-sdk/util/assert.rb +1 -3
- data/lib/stormpath-sdk/version.rb +2 -2
- data/spec/auth/basic_authenticator_spec.rb +28 -24
- data/spec/auth/register_service_provider_spec.rb +68 -0
- data/spec/auth/sauthc1_signer_spec.rb +8 -4
- data/spec/cache/cache_entry_spec.rb +28 -29
- data/spec/cache/cache_spec.rb +9 -9
- data/spec/cache/cache_stats_spec.rb +1 -1
- data/spec/client_spec.rb +63 -63
- data/spec/data_store_spec.rb +23 -14
- data/spec/oauth/access_token_authentication_result_spec.rb +8 -2
- data/spec/provider/account_resolver_spec.rb +6 -4
- data/spec/provider/provider_spec.rb +6 -6
- data/spec/resource/account_creation_policy_spec.rb +1 -1
- data/spec/resource/account_link_spec.rb +7 -15
- data/spec/resource/account_spec.rb +17 -17
- data/spec/resource/account_store_mapping_spec.rb +16 -22
- data/spec/resource/account_store_spec.rb +3 -3
- data/spec/resource/application_spec.rb +324 -330
- data/spec/resource/base_spec.rb +7 -31
- data/spec/resource/collection_spec.rb +63 -114
- data/spec/resource/custom_data_spec.rb +1 -1
- data/spec/resource/directory_spec.rb +91 -87
- data/spec/resource/expansion_spec.rb +10 -10
- data/spec/resource/factor_spec.rb +1 -1
- data/spec/resource/group_spec.rb +1 -1
- data/spec/resource/linked_account_spec.rb +7 -7
- data/spec/resource/organization_spec.rb +12 -11
- data/spec/resource/phone_spec.rb +1 -1
- data/spec/resource/registered_saml_service_provider_spec.rb +35 -0
- data/spec/resource/saml_identity_provider_metadata_spec.rb +27 -0
- data/spec/resource/saml_identity_provider_spec.rb +94 -0
- data/spec/resource/saml_policy_spec.rb +27 -0
- data/spec/resource/saml_service_provider_registration_spec.rb +58 -0
- data/spec/resource/saml_service_provider_spec.rb +19 -0
- data/spec/resource/status_spec.rb +4 -3
- data/spec/resource/tenant_spec.rb +4 -6
- data/spec/spec_helper.rb +1 -1
- data/spec/support/custom_data_save_period.rb +4 -0
- data/spec/support/custom_data_storage_behavior.rb +7 -8
- data/spec/support/mocked_provider_accounts.rb +101 -101
- data/spec/support/mocked_saml_responses.rb +130 -0
- data/spec/support/resource_factory.rb +4 -4
- data/spec/support/resource_helpers.rb +10 -4
- data/spec/support/resource_matchers.rb +4 -4
- data/spec/support/test_request_executor.rb +2 -2
- metadata +21 -8
- data/lib/stormpath-sdk/provider/saml/saml_provider_metadata.rb +0 -19
- data/spec/fixtures/response/create_saml_directory.json +0 -26
- data/spec/fixtures/response/create_saml_directory_mapping_rules.json +0 -12
- data/spec/fixtures/response/get_saml_directory_provider.json +0 -16
- data/spec/fixtures/response/get_saml_directory_provider_metadata.json +0 -12
data/spec/resource/base_spec.rb
CHANGED
|
@@ -6,13 +6,7 @@ describe Stormpath::Resource::Base do
|
|
|
6
6
|
class TestResource < Stormpath::Resource::Base
|
|
7
7
|
prop_accessor :username, :given_name
|
|
8
8
|
end
|
|
9
|
-
|
|
10
|
-
let(:resource) do
|
|
11
|
-
TestResource.new({
|
|
12
|
-
'username' => 'bar',
|
|
13
|
-
'givenName' => 'foo'
|
|
14
|
-
}, nil)
|
|
15
|
-
end
|
|
9
|
+
let(:resource) { TestResource.new({ 'username' => 'bar', 'givenName' => 'foo' }, nil) }
|
|
16
10
|
|
|
17
11
|
it 'generates a getter method for each property' do
|
|
18
12
|
expect(resource.username).to eq('bar')
|
|
@@ -33,13 +27,7 @@ describe Stormpath::Resource::Base do
|
|
|
33
27
|
class TestResource < Stormpath::Resource::Base
|
|
34
28
|
prop_non_printable :password
|
|
35
29
|
end
|
|
36
|
-
|
|
37
|
-
let(:resource) do
|
|
38
|
-
TestResource.new({
|
|
39
|
-
'username' => 'bar',
|
|
40
|
-
'password' => 'P@$$w0rd'
|
|
41
|
-
}, nil)
|
|
42
|
-
end
|
|
30
|
+
let(:resource) { TestResource.new({ 'username' => 'bar', 'password' => 'P@$$w0rd' }, nil) }
|
|
43
31
|
|
|
44
32
|
it 'marks that property as not being printable' do
|
|
45
33
|
expect(resource.inspect).to include('username')
|
|
@@ -70,14 +58,10 @@ describe Stormpath::Resource::Base do
|
|
|
70
58
|
class TestResource < Stormpath::Resource::Base; end
|
|
71
59
|
|
|
72
60
|
context 'compared against an object of the same class' do
|
|
73
|
-
let(:resource)
|
|
74
|
-
TestResource.new('http://foo.com/test/123')
|
|
75
|
-
end
|
|
61
|
+
let(:resource) { TestResource.new('http://foo.com/test/123') }
|
|
76
62
|
|
|
77
63
|
context 'href matches' do
|
|
78
|
-
let(:other)
|
|
79
|
-
TestResource.new('http://foo.com/test/123')
|
|
80
|
-
end
|
|
64
|
+
let(:other) { TestResource.new('http://foo.com/test/123') }
|
|
81
65
|
|
|
82
66
|
it 'passes' do
|
|
83
67
|
expect(resource).to eq(other)
|
|
@@ -85,9 +69,7 @@ describe Stormpath::Resource::Base do
|
|
|
85
69
|
end
|
|
86
70
|
|
|
87
71
|
context 'href does not match' do
|
|
88
|
-
let(:other)
|
|
89
|
-
TestResource.new('http://foo.com/test/456')
|
|
90
|
-
end
|
|
72
|
+
let(:other) { TestResource.new('http://foo.com/test/456') }
|
|
91
73
|
|
|
92
74
|
it 'fails' do
|
|
93
75
|
expect(resource).to_not eq(other)
|
|
@@ -97,14 +79,8 @@ describe Stormpath::Resource::Base do
|
|
|
97
79
|
|
|
98
80
|
context 'compared against an object of another class' do
|
|
99
81
|
class NotAResource; end
|
|
100
|
-
|
|
101
|
-
let(:
|
|
102
|
-
TestResource.new('http://foo.com/test/123')
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
let(:other) do
|
|
106
|
-
NotAResource.new
|
|
107
|
-
end
|
|
82
|
+
let(:resource) { TestResource.new('http://foo.com/test/123') }
|
|
83
|
+
let(:other) { NotAResource.new }
|
|
108
84
|
|
|
109
85
|
it 'fails' do
|
|
110
86
|
expect(resource).to_not eq(other)
|
|
@@ -1,23 +1,13 @@
|
|
|
1
1
|
require 'spec_helper'
|
|
2
2
|
|
|
3
3
|
describe Stormpath::Resource::Collection, :vcr do
|
|
4
|
-
let(:href)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
let(:item_class) do
|
|
9
|
-
Stormpath::Resource::Application
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
let(:client) do
|
|
13
|
-
Stormpath::Client
|
|
14
|
-
end
|
|
4
|
+
let(:href) { 'http://example.com' }
|
|
5
|
+
let(:item_class) { Stormpath::Resource::Application }
|
|
6
|
+
let(:client) { Stormpath::Client }
|
|
15
7
|
|
|
16
8
|
describe '#collection_href' do
|
|
17
9
|
context 'by default' do
|
|
18
|
-
let(:collection)
|
|
19
|
-
Stormpath::Resource::Collection.new href, item_class, client
|
|
20
|
-
end
|
|
10
|
+
let(:collection) { Stormpath::Resource::Collection.new href, item_class, client }
|
|
21
11
|
|
|
22
12
|
it 'defaults to href' do
|
|
23
13
|
expect(collection.collection_href).to eq href
|
|
@@ -25,9 +15,7 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
25
15
|
end
|
|
26
16
|
|
|
27
17
|
context 'when specified' do
|
|
28
|
-
let(:collection_href)
|
|
29
|
-
'http://fakie.com'
|
|
30
|
-
end
|
|
18
|
+
let(:collection_href) { 'http://fakie.com' }
|
|
31
19
|
|
|
32
20
|
let(:collection) do
|
|
33
21
|
Stormpath::Resource::Collection.new(
|
|
@@ -43,13 +31,8 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
43
31
|
end
|
|
44
32
|
|
|
45
33
|
describe '#offset' do
|
|
46
|
-
let(:collection)
|
|
47
|
-
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
let!(:offset) do
|
|
51
|
-
collection.offset 5
|
|
52
|
-
end
|
|
34
|
+
let(:collection) { Stormpath::Resource::Collection.new href, item_class, client }
|
|
35
|
+
let!(:offset) { collection.offset 5 }
|
|
53
36
|
|
|
54
37
|
it 'returns the collection' do
|
|
55
38
|
expect(offset.class).to eq Stormpath::Resource::Collection
|
|
@@ -61,13 +44,9 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
61
44
|
end
|
|
62
45
|
|
|
63
46
|
describe '#limit' do
|
|
64
|
-
let(:collection)
|
|
65
|
-
Stormpath::Resource::Collection.new href, item_class, client
|
|
66
|
-
end
|
|
47
|
+
let(:collection) { Stormpath::Resource::Collection.new href, item_class, client }
|
|
67
48
|
|
|
68
|
-
let!(:limit)
|
|
69
|
-
collection.limit 100
|
|
70
|
-
end
|
|
49
|
+
let!(:limit) { collection.limit 100 }
|
|
71
50
|
|
|
72
51
|
it 'returns the collection' do
|
|
73
52
|
expect(limit.class).to eq Stormpath::Resource::Collection
|
|
@@ -79,17 +58,11 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
79
58
|
end
|
|
80
59
|
|
|
81
60
|
describe '#order' do
|
|
82
|
-
let(:collection)
|
|
83
|
-
Stormpath::Resource::Collection.new href, item_class, client
|
|
84
|
-
end
|
|
61
|
+
let(:collection) { Stormpath::Resource::Collection.new href, item_class, client }
|
|
85
62
|
|
|
86
|
-
let(:order_statement)
|
|
87
|
-
'lastName asc,age desc'
|
|
88
|
-
end
|
|
63
|
+
let(:order_statement) { 'lastName asc,age desc' }
|
|
89
64
|
|
|
90
|
-
let!(:order)
|
|
91
|
-
collection.order order_statement
|
|
92
|
-
end
|
|
65
|
+
let!(:order) { collection.order order_statement }
|
|
93
66
|
|
|
94
67
|
it 'returns the collection' do
|
|
95
68
|
expect(order.class).to eq Stormpath::Resource::Collection
|
|
@@ -101,18 +74,12 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
101
74
|
end
|
|
102
75
|
|
|
103
76
|
describe '#search' do
|
|
104
|
-
let(:collection)
|
|
105
|
-
Stormpath::Resource::Collection.new href, item_class, client
|
|
106
|
-
end
|
|
77
|
+
let(:collection) { Stormpath::Resource::Collection.new href, item_class, client }
|
|
107
78
|
|
|
108
79
|
context 'when passed a string' do
|
|
109
|
-
let(:query)
|
|
110
|
-
'dagnabbit'
|
|
111
|
-
end
|
|
80
|
+
let(:query) { 'dagnabbit' }
|
|
112
81
|
|
|
113
|
-
let!(:search)
|
|
114
|
-
collection.search query
|
|
115
|
-
end
|
|
82
|
+
let!(:search) { collection.search query }
|
|
116
83
|
|
|
117
84
|
it 'returns the collection' do
|
|
118
85
|
expect(search.class).to eq Stormpath::Resource::Collection
|
|
@@ -124,13 +91,8 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
124
91
|
end
|
|
125
92
|
|
|
126
93
|
context 'when passed a hash of attributes' do
|
|
127
|
-
let(:query_hash)
|
|
128
|
-
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
let!(:search) do
|
|
132
|
-
collection.search query_hash
|
|
133
|
-
end
|
|
94
|
+
let(:query_hash) { { name: 'Stanley Kubrick', description: 'That dude was a sick maniac' } }
|
|
95
|
+
let!(:search) { collection.search query_hash }
|
|
134
96
|
|
|
135
97
|
it 'returns the collection' do
|
|
136
98
|
expect(search.class).to eq Stormpath::Resource::Collection
|
|
@@ -143,9 +105,7 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
143
105
|
end
|
|
144
106
|
|
|
145
107
|
describe '#criteria' do
|
|
146
|
-
let(:collection)
|
|
147
|
-
Stormpath::Resource::Collection.new href, item_class, client
|
|
148
|
-
end
|
|
108
|
+
let(:collection) { Stormpath::Resource::Collection.new href, item_class, client }
|
|
149
109
|
|
|
150
110
|
context 'when no fetch criteria present' do
|
|
151
111
|
it 'returns an empty hash for criteria' do
|
|
@@ -173,13 +133,11 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
173
133
|
|
|
174
134
|
let(:groups) do
|
|
175
135
|
('A'..'Z').map do |letter|
|
|
176
|
-
directory.groups.create
|
|
136
|
+
directory.groups.create(name: "#{letter}. pagination testing group ")
|
|
177
137
|
end
|
|
178
138
|
end
|
|
179
139
|
|
|
180
|
-
after
|
|
181
|
-
directory.delete
|
|
182
|
-
end
|
|
140
|
+
after { directory.delete }
|
|
183
141
|
|
|
184
142
|
it 'should respond as expected with or without limits' do
|
|
185
143
|
expect(groups.count).to eq(26)
|
|
@@ -212,21 +170,14 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
212
170
|
|
|
213
171
|
context 'testing limits and offsets with name checking' do
|
|
214
172
|
let(:directory) { test_api_client.directories.create(directory_attrs) }
|
|
173
|
+
let!(:groups) { ('1'..'100').map { |number| directory.groups.create(name: number) } }
|
|
215
174
|
|
|
216
|
-
|
|
217
|
-
('1'..'100').map do |number|
|
|
218
|
-
directory.groups.create name: number
|
|
219
|
-
end
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
after do
|
|
223
|
-
directory.delete
|
|
224
|
-
end
|
|
175
|
+
after { directory.delete }
|
|
225
176
|
|
|
226
177
|
it 'should paginate properly' do
|
|
227
178
|
expect(directory.groups.count).to eq(100)
|
|
228
179
|
|
|
229
|
-
expect(directory.groups.map
|
|
180
|
+
expect(directory.groups.map(&:name)).to eq(('1'..'100').to_a.sort)
|
|
230
181
|
|
|
231
182
|
expect(directory.groups.limit(30).count).to eq(100)
|
|
232
183
|
|
|
@@ -244,23 +195,23 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
244
195
|
|
|
245
196
|
expect(directory.groups.limit(30).offset(90).current_page.size).to eq(100)
|
|
246
197
|
|
|
247
|
-
expect(directory.groups.limit(30).map
|
|
198
|
+
expect(directory.groups.limit(30).map(&:name)).to eq(('1'..'100').to_a.sort)
|
|
248
199
|
|
|
249
|
-
expect(directory.groups.limit(30).current_page.items.map
|
|
200
|
+
expect(directory.groups.limit(30).current_page.items.map(&:name)).to eq(('1'..'100').to_a.sort.first(30))
|
|
250
201
|
|
|
251
|
-
expect(directory.groups.limit(30).offset(30).map
|
|
202
|
+
expect(directory.groups.limit(30).offset(30).map(&:name)).to eq(('1'..'100').to_a.sort.drop(30))
|
|
252
203
|
|
|
253
|
-
expect(directory.groups.limit(30).offset(30).current_page.items.map
|
|
204
|
+
expect(directory.groups.limit(30).offset(30).current_page.items.map(&:name)).to eq(('1'..'100').to_a.sort.drop(30).first(30))
|
|
254
205
|
|
|
255
|
-
expect(directory.groups.limit(30).offset(60).map
|
|
206
|
+
expect(directory.groups.limit(30).offset(60).map(&:name)).to eq(('1'..'100').to_a.sort.drop(60))
|
|
256
207
|
|
|
257
|
-
expect(directory.groups.limit(30).offset(60).current_page.items.map
|
|
208
|
+
expect(directory.groups.limit(30).offset(60).current_page.items.map(&:name)).to eq(('1'..'100').to_a.sort.drop(60).first(30))
|
|
258
209
|
|
|
259
|
-
expect(directory.groups.limit(30).offset(90).map
|
|
210
|
+
expect(directory.groups.limit(30).offset(90).map(&:name)).to eq(('1'..'100').to_a.sort.drop(90))
|
|
260
211
|
|
|
261
|
-
expect(directory.groups.limit(30).offset(90).current_page.items.map
|
|
212
|
+
expect(directory.groups.limit(30).offset(90).current_page.items.map(&:name)).to eq(('1'..'100').to_a.sort.drop(90).first(30))
|
|
262
213
|
|
|
263
|
-
expect(directory.groups.limit(30).offset(90).current_page.items.map
|
|
214
|
+
expect(directory.groups.limit(30).offset(90).current_page.items.map(&:name)).to eq(('1'..'100').to_a.sort.drop(90).first(10))
|
|
264
215
|
|
|
265
216
|
group_count = 0
|
|
266
217
|
directory.groups.each do |group|
|
|
@@ -280,16 +231,16 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
280
231
|
let(:username) { 'jlpicard/!@$%^ *()_-+=?><]}[{' }
|
|
281
232
|
|
|
282
233
|
let!(:account) do
|
|
283
|
-
directory.accounts.create
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
234
|
+
directory.accounts.create(
|
|
235
|
+
username: username,
|
|
236
|
+
email: "captain#{default_domain}",
|
|
237
|
+
givenName: 'Jean-Luc',
|
|
238
|
+
surname: 'Picard',
|
|
239
|
+
password: 'hakunaMatata179Enterprise'
|
|
240
|
+
)
|
|
288
241
|
end
|
|
289
242
|
|
|
290
|
-
after
|
|
291
|
-
directory.delete
|
|
292
|
-
end
|
|
243
|
+
after { directory.delete }
|
|
293
244
|
|
|
294
245
|
it 'should search accounts by username' do
|
|
295
246
|
expect(directory.accounts.search(username: username).count).to eq(1)
|
|
@@ -312,27 +263,27 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
312
263
|
let(:directory) { test_api_client.directories.create(directory_attrs) }
|
|
313
264
|
|
|
314
265
|
let!(:account) do
|
|
315
|
-
directory.accounts.create
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
266
|
+
directory.accounts.create(
|
|
267
|
+
username: 'jlpicard',
|
|
268
|
+
email: "captain#{default_domain}",
|
|
269
|
+
givenName: 'Jean-Luc',
|
|
270
|
+
surname: 'Picard',
|
|
271
|
+
password: 'hakunaMatata179Enterprise'
|
|
272
|
+
)
|
|
320
273
|
end
|
|
321
274
|
|
|
322
|
-
after
|
|
323
|
-
directory.delete
|
|
324
|
-
end
|
|
275
|
+
after { directory.delete }
|
|
325
276
|
|
|
326
277
|
it 'should search accounts by username with asterisk at the beginning' do
|
|
327
|
-
expect(directory.accounts.search(username:
|
|
278
|
+
expect(directory.accounts.search(username: '*card').count).to eq(1)
|
|
328
279
|
end
|
|
329
280
|
|
|
330
281
|
it 'should search accounts by username with asterisk at the end' do
|
|
331
|
-
expect(directory.accounts.search(username:
|
|
282
|
+
expect(directory.accounts.search(username: 'jl*').count).to eq(1)
|
|
332
283
|
end
|
|
333
284
|
|
|
334
285
|
it 'should search accounts by username with asterisk at the beginning and the end' do
|
|
335
|
-
expect(directory.accounts.search(username:
|
|
286
|
+
expect(directory.accounts.search(username: '*pic*').count).to eq(1)
|
|
336
287
|
end
|
|
337
288
|
end
|
|
338
289
|
|
|
@@ -340,27 +291,27 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
340
291
|
let(:directory) { test_api_client.directories.create(directory_attrs) }
|
|
341
292
|
|
|
342
293
|
let!(:account) do
|
|
343
|
-
directory.accounts.create
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
294
|
+
directory.accounts.create(
|
|
295
|
+
username: 'jlpicard',
|
|
296
|
+
email: "captain#{default_domain}",
|
|
297
|
+
givenName: 'Jean-Luc',
|
|
298
|
+
surname: 'Picard',
|
|
299
|
+
password: 'hakunaMatata179Enterprise'
|
|
300
|
+
)
|
|
348
301
|
end
|
|
349
302
|
|
|
350
|
-
after
|
|
351
|
-
directory.delete
|
|
352
|
-
end
|
|
303
|
+
after { directory.delete }
|
|
353
304
|
|
|
354
305
|
it 'should search accounts by username with asterisk at the beginning' do
|
|
355
|
-
expect(directory.accounts.search(username:
|
|
306
|
+
expect(directory.accounts.search(username: '*card', email: '*stormpath.com').count).to eq(1)
|
|
356
307
|
end
|
|
357
308
|
|
|
358
309
|
it 'should search accounts by username with asterisk at the end' do
|
|
359
|
-
expect(directory.accounts.search(username:
|
|
310
|
+
expect(directory.accounts.search(username: 'jl*', email: 'capt*').count).to eq(1)
|
|
360
311
|
end
|
|
361
312
|
|
|
362
313
|
it 'should search accounts by username with asterisk at the beginning and the end' do
|
|
363
|
-
expect(directory.accounts.search(username:
|
|
314
|
+
expect(directory.accounts.search(username: '*pic*', email: '*stormpath*').count).to eq(1)
|
|
364
315
|
end
|
|
365
316
|
end
|
|
366
317
|
|
|
@@ -387,9 +338,7 @@ describe Stormpath::Resource::Collection, :vcr do
|
|
|
387
338
|
)
|
|
388
339
|
end
|
|
389
340
|
|
|
390
|
-
after
|
|
391
|
-
directory.delete
|
|
392
|
-
end
|
|
341
|
+
after { directory.delete }
|
|
393
342
|
|
|
394
343
|
context 'camelCase' do
|
|
395
344
|
before do
|
|
@@ -14,7 +14,7 @@ describe Stormpath::Resource::CustomData, :vcr do
|
|
|
14
14
|
|
|
15
15
|
context 'without caching regions' do
|
|
16
16
|
let(:disabled_cache_client) do
|
|
17
|
-
@disabled_cache_client ||= Stormpath::Client.new(
|
|
17
|
+
@disabled_cache_client ||= Stormpath::Client.new(api_key: test_api_key, cache: { store: Stormpath::Cache::DisabledCacheStore })
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
let(:directory) { disabled_cache_client.directories.create(directory_attrs) }
|
|
@@ -220,7 +220,7 @@ describe Stormpath::Resource::Directory, :vcr do
|
|
|
220
220
|
end
|
|
221
221
|
|
|
222
222
|
it 'can authenticate with the account credentials' do
|
|
223
|
-
auth_request = Stormpath::Authentication::UsernamePasswordRequest.new
|
|
223
|
+
auth_request = Stormpath::Authentication::UsernamePasswordRequest.new('jlucpicard', 'qwerty')
|
|
224
224
|
auth_result = application.authenticate_account auth_request
|
|
225
225
|
|
|
226
226
|
expect(auth_result).to be_a Stormpath::Authentication::AuthenticationResult
|
|
@@ -253,7 +253,7 @@ describe Stormpath::Resource::Directory, :vcr do
|
|
|
253
253
|
end
|
|
254
254
|
|
|
255
255
|
it 'can authenticate with the account credentials' do
|
|
256
|
-
auth_request = Stormpath::Authentication::UsernamePasswordRequest.new
|
|
256
|
+
auth_request = Stormpath::Authentication::UsernamePasswordRequest.new('jlucpicard', 'testing12')
|
|
257
257
|
auth_result = application.authenticate_account auth_request
|
|
258
258
|
|
|
259
259
|
expect(auth_result).to be_a Stormpath::Authentication::AuthenticationResult
|
|
@@ -286,7 +286,7 @@ describe Stormpath::Resource::Directory, :vcr do
|
|
|
286
286
|
end
|
|
287
287
|
|
|
288
288
|
it 'can authenticate with the account credentials' do
|
|
289
|
-
auth_request = Stormpath::Authentication::UsernamePasswordRequest.new
|
|
289
|
+
auth_request = Stormpath::Authentication::UsernamePasswordRequest.new('jlucpicard', 'NotSecure')
|
|
290
290
|
auth_result = application.authenticate_account auth_request
|
|
291
291
|
|
|
292
292
|
expect(auth_result).to be_a Stormpath::Authentication::AuthenticationResult
|
|
@@ -311,9 +311,14 @@ describe Stormpath::Resource::Directory, :vcr do
|
|
|
311
311
|
end
|
|
312
312
|
|
|
313
313
|
describe '#create_directory_with_custom_data' do
|
|
314
|
+
let(:directory_name) { "rubysdkdir-#{random_number}" }
|
|
314
315
|
let(:directory) do
|
|
315
|
-
test_api_client.directories.create(
|
|
316
|
-
|
|
316
|
+
test_api_client.directories.create(
|
|
317
|
+
directory_attrs(
|
|
318
|
+
name: directory_name,
|
|
319
|
+
description: directory_name
|
|
320
|
+
)
|
|
321
|
+
)
|
|
317
322
|
end
|
|
318
323
|
|
|
319
324
|
after { directory.delete }
|
|
@@ -322,24 +327,26 @@ describe Stormpath::Resource::Directory, :vcr do
|
|
|
322
327
|
directory.custom_data['category'] = 'classified'
|
|
323
328
|
|
|
324
329
|
directory.save
|
|
325
|
-
expect(directory.name).to eq(
|
|
326
|
-
expect(directory.description).to eq(
|
|
330
|
+
expect(directory.name).to eq(directory_name)
|
|
331
|
+
expect(directory.description).to eq(directory_name)
|
|
327
332
|
expect(directory.custom_data['category']).to eq('classified')
|
|
328
333
|
end
|
|
329
334
|
end
|
|
330
335
|
|
|
331
336
|
describe 'create directory with provider data' do
|
|
337
|
+
let(:directory_name) { "rubysdkdirprovider-#{random_number}" }
|
|
338
|
+
|
|
332
339
|
context 'valida data' do
|
|
333
340
|
let(:directory) do
|
|
334
341
|
test_api_client.directories.create(
|
|
335
|
-
name:
|
|
336
|
-
description:
|
|
342
|
+
name: directory_name,
|
|
343
|
+
description: directory_name,
|
|
337
344
|
provider: {
|
|
338
|
-
provider_id:
|
|
339
|
-
sso_login_url:
|
|
340
|
-
sso_logout_url:
|
|
341
|
-
encoded_x509_signing_cert:"-----BEGIN CERTIFICATE-----\n...Certificate goes here...\n-----END CERTIFICATE-----",
|
|
342
|
-
request_signature_algorithm:
|
|
345
|
+
provider_id: 'saml',
|
|
346
|
+
sso_login_url: 'https://yourIdp.com/saml2/sso/login',
|
|
347
|
+
sso_logout_url: 'https://yourIdp.com/saml2/sso/logout',
|
|
348
|
+
encoded_x509_signing_cert: "-----BEGIN CERTIFICATE-----\n...Certificate goes here...\n-----END CERTIFICATE-----",
|
|
349
|
+
request_signature_algorithm: 'RSA-SHA256'
|
|
343
350
|
}
|
|
344
351
|
)
|
|
345
352
|
end
|
|
@@ -349,17 +356,17 @@ describe Stormpath::Resource::Directory, :vcr do
|
|
|
349
356
|
end
|
|
350
357
|
|
|
351
358
|
it 'creates the directory with provider data' do
|
|
352
|
-
stub_request(:post,
|
|
353
|
-
to_return(status:200, body:
|
|
359
|
+
stub_request(:post, 'https://api.stormpath.com/v1/directories')
|
|
360
|
+
.to_return(status: 200, body: Stormpath::Test.mocked_create_saml_directory)
|
|
354
361
|
|
|
355
|
-
stub_request(:get, directory.href +
|
|
356
|
-
to_return(status: 200, body:
|
|
362
|
+
stub_request(:get, directory.href + '/provider')
|
|
363
|
+
.to_return(status: 200, body: Stormpath::Test.mocked_saml_directory_provider_response)
|
|
357
364
|
|
|
358
365
|
directory
|
|
359
|
-
expect(directory.provider.provider_id).to eq(
|
|
360
|
-
expect(directory.provider.sso_login_url).to eq(
|
|
361
|
-
expect(directory.provider.sso_logout_url).to eq(
|
|
362
|
-
expect(directory.provider.request_signature_algorithm).to eq(
|
|
366
|
+
expect(directory.provider.provider_id).to eq('saml')
|
|
367
|
+
expect(directory.provider.sso_login_url).to eq('https://yourIdp.com/saml2/sso/login')
|
|
368
|
+
expect(directory.provider.sso_logout_url).to eq('https://yourIdp.com/saml2/sso/logout')
|
|
369
|
+
expect(directory.provider.request_signature_algorithm).to eq('RSA-SHA256')
|
|
363
370
|
end
|
|
364
371
|
end
|
|
365
372
|
|
|
@@ -367,14 +374,14 @@ describe Stormpath::Resource::Directory, :vcr do
|
|
|
367
374
|
it 'raises Stormpath::Error' do
|
|
368
375
|
expect do
|
|
369
376
|
test_api_client.directories.create(
|
|
370
|
-
name:
|
|
371
|
-
description:
|
|
377
|
+
name: directory_name,
|
|
378
|
+
description: directory_name,
|
|
372
379
|
provider: {
|
|
373
|
-
provider_id:
|
|
374
|
-
sso_login_url:
|
|
375
|
-
sso_logout_url:
|
|
376
|
-
encoded_x509_signing_cert:
|
|
377
|
-
request_signature_algorithm:
|
|
380
|
+
provider_id: 'saml',
|
|
381
|
+
sso_login_url: '',
|
|
382
|
+
sso_logout_url: '',
|
|
383
|
+
encoded_x509_signing_cert: '',
|
|
384
|
+
request_signature_algorithm: 'RSA-SHA256'
|
|
378
385
|
}
|
|
379
386
|
)
|
|
380
387
|
end.to raise_error Stormpath::Error
|
|
@@ -383,16 +390,17 @@ describe Stormpath::Resource::Directory, :vcr do
|
|
|
383
390
|
end
|
|
384
391
|
|
|
385
392
|
describe 'saml #provider' do
|
|
393
|
+
let(:directory_name) { "rubysdkdirsaml-#{random_number}" }
|
|
386
394
|
let(:directory) do
|
|
387
395
|
test_api_client.directories.create(
|
|
388
|
-
name:
|
|
389
|
-
description:
|
|
396
|
+
name: directory_name,
|
|
397
|
+
description: directory_name,
|
|
390
398
|
provider: {
|
|
391
|
-
provider_id:
|
|
392
|
-
sso_login_url:
|
|
393
|
-
sso_logout_url:
|
|
394
|
-
encoded_x509_signing_cert:"-----BEGIN CERTIFICATE-----\n...Certificate goes here...\n-----END CERTIFICATE-----",
|
|
395
|
-
request_signature_algorithm:
|
|
399
|
+
provider_id: 'saml',
|
|
400
|
+
sso_login_url: 'https://yourIdp.com/saml2/sso/login',
|
|
401
|
+
sso_logout_url: 'https://yourIdp.com/saml2/sso/logout',
|
|
402
|
+
encoded_x509_signing_cert: "-----BEGIN CERTIFICATE-----\n...Certificate goes here...\n-----END CERTIFICATE-----",
|
|
403
|
+
request_signature_algorithm: 'RSA-SHA256'
|
|
396
404
|
}
|
|
397
405
|
)
|
|
398
406
|
end
|
|
@@ -402,33 +410,34 @@ describe Stormpath::Resource::Directory, :vcr do
|
|
|
402
410
|
end
|
|
403
411
|
|
|
404
412
|
it 'returnes provider data' do
|
|
405
|
-
stub_request(:post,
|
|
406
|
-
to_return(status:200, body:
|
|
413
|
+
stub_request(:post, 'https://api.stormpath.com/v1/directories')
|
|
414
|
+
.to_return(status: 200, body: Stormpath::Test.mocked_create_saml_directory)
|
|
407
415
|
|
|
408
|
-
stub_request(:get, directory.href +
|
|
409
|
-
to_return(status: 200, body:
|
|
416
|
+
stub_request(:get, directory.href + '/provider')
|
|
417
|
+
.to_return(status: 200, body: Stormpath::Test.mocked_saml_directory_provider_response)
|
|
410
418
|
|
|
411
419
|
directory
|
|
412
420
|
expect(directory.provider.href).not_to be_empty
|
|
413
|
-
expect(directory.provider.provider_id).to eq(
|
|
414
|
-
expect(directory.provider.sso_login_url).to eq(
|
|
415
|
-
expect(directory.provider.sso_logout_url).to eq(
|
|
421
|
+
expect(directory.provider.provider_id).to eq('saml')
|
|
422
|
+
expect(directory.provider.sso_login_url).to eq('https://yourIdp.com/saml2/sso/login')
|
|
423
|
+
expect(directory.provider.sso_logout_url).to eq('https://yourIdp.com/saml2/sso/logout')
|
|
416
424
|
expect(directory.provider.encoded_x509_signing_cert).not_to be_empty
|
|
417
|
-
expect(directory.provider.request_signature_algorithm).to eq(
|
|
425
|
+
expect(directory.provider.request_signature_algorithm).to eq('RSA-SHA256')
|
|
418
426
|
end
|
|
419
427
|
end
|
|
420
428
|
|
|
421
|
-
describe 'saml #
|
|
429
|
+
describe 'saml #service_provider_metadata' do
|
|
430
|
+
let(:directory_name) { "rubysdkdirsaml-#{random_number}" }
|
|
422
431
|
let(:directory) do
|
|
423
432
|
test_api_client.directories.create(
|
|
424
|
-
name:
|
|
433
|
+
name: directory_name,
|
|
425
434
|
description: 'description_for_some_test_directory',
|
|
426
435
|
provider: {
|
|
427
|
-
provider_id:
|
|
428
|
-
sso_login_url:
|
|
429
|
-
sso_logout_url:
|
|
430
|
-
encoded_x509_signing_cert:"-----BEGIN CERTIFICATE-----\n...Certificate goes here...\n-----END CERTIFICATE-----",
|
|
431
|
-
request_signature_algorithm:
|
|
436
|
+
provider_id: 'saml',
|
|
437
|
+
sso_login_url: 'https://yourIdp.com/saml2/sso/login',
|
|
438
|
+
sso_logout_url: 'https://yourIdp.com/saml2/sso/logout',
|
|
439
|
+
encoded_x509_signing_cert: "-----BEGIN CERTIFICATE-----\n...Certificate goes here...\n-----END CERTIFICATE-----",
|
|
440
|
+
request_signature_algorithm: 'RSA-SHA256'
|
|
432
441
|
}
|
|
433
442
|
)
|
|
434
443
|
end
|
|
@@ -437,34 +446,35 @@ describe Stormpath::Resource::Directory, :vcr do
|
|
|
437
446
|
directory.delete if directory
|
|
438
447
|
end
|
|
439
448
|
|
|
440
|
-
it 'returnes provider metadata' do
|
|
441
|
-
stub_request(:post,
|
|
442
|
-
to_return(status:200, body:
|
|
449
|
+
it 'returnes service provider metadata' do
|
|
450
|
+
stub_request(:post, 'https://api.stormpath.com/v1/directories')
|
|
451
|
+
.to_return(status: 200, body: Stormpath::Test.mocked_create_saml_directory)
|
|
443
452
|
|
|
444
|
-
stub_request(:get, directory.href +
|
|
445
|
-
to_return(status: 200, body:
|
|
453
|
+
stub_request(:get, directory.href + '/provider')
|
|
454
|
+
.to_return(status: 200, body: Stormpath::Test.mocked_saml_directory_provider_response)
|
|
455
|
+
stub_request(:get, directory.service_provider_metadata.href)
|
|
456
|
+
.to_return(body: Stormpath::Test.mocked_saml_directory_provider_metadata_response, status: 200)
|
|
446
457
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
expect(directory.
|
|
451
|
-
expect(directory.provider_metadata.entity_id).not_to be_empty
|
|
452
|
-
expect(directory.provider_metadata.assertion_consumer_service_post_endpoint).not_to be_empty
|
|
453
|
-
expect(directory.provider_metadata.x509_signing_cert).not_to be_empty
|
|
458
|
+
expect(directory.service_provider_metadata.href).not_to be_empty
|
|
459
|
+
expect(directory.service_provider_metadata.entity_id).not_to be_empty
|
|
460
|
+
expect(directory.service_provider_metadata.assertion_consumer_service_post_endpoint).not_to be_empty
|
|
461
|
+
expect(directory.service_provider_metadata.x509_signing_cert).not_to be_empty
|
|
454
462
|
end
|
|
455
463
|
end
|
|
456
464
|
|
|
457
465
|
describe 'saml mapping rules' do
|
|
466
|
+
let(:directory_name) { "rubysdkdirsaml-#{random_number}" }
|
|
467
|
+
let(:rule) { { 'name' => 'email', 'accountAttributes' => ['email'] } }
|
|
458
468
|
let(:directory) do
|
|
459
469
|
test_api_client.directories.create(
|
|
460
|
-
name:
|
|
470
|
+
name: directory_name,
|
|
461
471
|
description: 'description_for_some_test_directory',
|
|
462
472
|
provider: {
|
|
463
|
-
provider_id:
|
|
464
|
-
sso_login_url:
|
|
465
|
-
sso_logout_url:
|
|
466
|
-
encoded_x509_signing_cert:
|
|
467
|
-
request_signature_algorithm:
|
|
473
|
+
provider_id: 'saml',
|
|
474
|
+
sso_login_url: 'https://yourIdp.com/saml2/sso/login',
|
|
475
|
+
sso_logout_url: 'https://yourIdp.com/saml2/sso/logout',
|
|
476
|
+
encoded_x509_signing_cert: Stormpath::Test.mocked_encoded_x509_signing_cert,
|
|
477
|
+
request_signature_algorithm: 'RSA-SHA256'
|
|
468
478
|
}
|
|
469
479
|
)
|
|
470
480
|
end
|
|
@@ -474,26 +484,19 @@ describe Stormpath::Resource::Directory, :vcr do
|
|
|
474
484
|
end
|
|
475
485
|
|
|
476
486
|
it 'updates the directory mappings' do
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
name: "uid",
|
|
480
|
-
account_attributes: ["username"]
|
|
481
|
-
}
|
|
482
|
-
])
|
|
487
|
+
stub_request(:post, 'https://api.stormpath.com/v1/directories')
|
|
488
|
+
.to_return(status: 200, body: Stormpath::Test.mocked_create_saml_directory)
|
|
483
489
|
|
|
484
|
-
stub_request(:
|
|
485
|
-
to_return(status:200, body:
|
|
490
|
+
stub_request(:get, directory.href + '/provider')
|
|
491
|
+
.to_return(status: 200, body: Stormpath::Test.mocked_saml_directory_provider_response)
|
|
486
492
|
|
|
487
|
-
stub_request(:
|
|
488
|
-
to_return(status: 200, body:
|
|
493
|
+
stub_request(:post, directory.provider.attribute_statement_mapping_rules.href)
|
|
494
|
+
.to_return(status: 200, body: Stormpath::Test.mocked_create_saml_directory_rules)
|
|
489
495
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
response = directory.create_attribute_mappings(mappings)
|
|
494
|
-
expect(response.items).to eq( [ { "name" => "uid4", "name_format" => "nil", "account_attributes" => ["username"] } ] )
|
|
496
|
+
directory.attribute_statement_mapping_rules.items = [rule]
|
|
497
|
+
response = directory.attribute_statement_mapping_rules.save
|
|
498
|
+
expect(response.items).to eq([{ 'name' => 'uid4', 'name_format' => 'nil', 'account_attributes' => ['username'] }])
|
|
495
499
|
end
|
|
496
|
-
|
|
497
500
|
end
|
|
498
501
|
|
|
499
502
|
describe '#create_account_with_custom_data' do
|
|
@@ -522,13 +525,14 @@ describe Stormpath::Resource::Directory, :vcr do
|
|
|
522
525
|
after { directory.delete }
|
|
523
526
|
|
|
524
527
|
context 'given a valid group' do
|
|
525
|
-
let(:
|
|
528
|
+
let(:group_name) { "rubysdkgroup#{random_number}" }
|
|
529
|
+
let(:created_group) { directory.groups.create(group_attrs(name: group_name)) }
|
|
526
530
|
|
|
527
531
|
after { created_group.delete }
|
|
528
532
|
|
|
529
533
|
it 'creates a group' do
|
|
530
534
|
expect(created_group).to be
|
|
531
|
-
expect(created_group.name).to eq(
|
|
535
|
+
expect(created_group.name).to eq(group_name)
|
|
532
536
|
end
|
|
533
537
|
end
|
|
534
538
|
end
|