passaporteweb-client 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +27 -23
- data/README.rdoc +1 -1
- data/lib/passaporte_web/version.rb +1 -1
- data/passaporteweb-client.gemspec +1 -1
- data/spec/passaporte_web/configuration_spec.rb +8 -8
- data/spec/passaporte_web/helpers_spec.rb +10 -10
- data/spec/passaporte_web/http_spec.rb +7 -7
- data/spec/passaporte_web/identity_service_account_spec.rb +60 -60
- data/spec/passaporte_web/identity_service_spec.rb +26 -26
- data/spec/passaporte_web/identity_spec.rb +117 -117
- data/spec/passaporte_web/notification_spec.rb +84 -84
- data/spec/passaporte_web/service_account_member_spec.rb +50 -50
- data/spec/passaporte_web/service_account_spec.rb +54 -54
- data/spec/passaporte_web_spec.rb +7 -7
- data/spec/spec_helper.rb +0 -4
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e512bf6c46aaa47a2611aa97e2ec6da1d9693c82
|
4
|
+
data.tar.gz: 77f311e1cb432a847205d35da67dd2f0d6e093db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 927f522260f75399053c80f494412234cb7bfd674109cd62de4cb1bf26c8f75b15ef43a5b47eff8a4b3bd5c39948d74eb7d8c623310f45281c760083114a3ecd
|
7
|
+
data.tar.gz: 4b9c77c2fcc5015c59443d4e07fede93970674a916751df8c5fae7a4ffb8cabc7c3442adbda46744f785f47a7547d35dc9e414dd3d85d69064fbaddd7e82e63f
|
data/Gemfile.lock
CHANGED
@@ -1,43 +1,43 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
passaporteweb-client (0.
|
5
|
-
multi_json (~> 1.
|
4
|
+
passaporteweb-client (0.3.0)
|
5
|
+
multi_json (~> 1.11)
|
6
6
|
rest-client (~> 1.8.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
addressable (2.
|
11
|
+
addressable (2.4.0)
|
12
12
|
awesome_print (1.6.1)
|
13
|
-
byebug (
|
14
|
-
columnize (= 0.9.0)
|
13
|
+
byebug (8.2.1)
|
15
14
|
coderay (1.1.0)
|
16
|
-
|
17
|
-
coveralls (0.8.1)
|
15
|
+
coveralls (0.8.10)
|
18
16
|
json (~> 1.8)
|
19
17
|
rest-client (>= 1.6.8, < 2)
|
20
|
-
simplecov (~> 0.
|
18
|
+
simplecov (~> 0.11.0)
|
21
19
|
term-ansicolor (~> 1.3)
|
22
20
|
thor (~> 0.19.1)
|
23
|
-
|
21
|
+
tins (~> 1.6.0)
|
22
|
+
crack (0.4.3)
|
23
|
+
safe_yaml (~> 1.0.0)
|
24
24
|
diff-lcs (1.2.5)
|
25
25
|
docile (1.1.5)
|
26
|
-
domain_name (0.5.
|
26
|
+
domain_name (0.5.25)
|
27
27
|
unf (>= 0.0.5, < 1.0.0)
|
28
28
|
http-cookie (1.0.2)
|
29
29
|
domain_name (~> 0.5)
|
30
30
|
json (1.8.3)
|
31
31
|
method_source (0.8.2)
|
32
|
-
mime-types (2.
|
33
|
-
multi_json (1.
|
34
|
-
netrc (0.
|
35
|
-
pry (0.10.
|
32
|
+
mime-types (2.99)
|
33
|
+
multi_json (1.11.2)
|
34
|
+
netrc (0.11.0)
|
35
|
+
pry (0.10.3)
|
36
36
|
coderay (~> 1.1.0)
|
37
37
|
method_source (~> 0.8.1)
|
38
38
|
slop (~> 3.4)
|
39
|
-
pry-byebug (3.
|
40
|
-
byebug (~>
|
39
|
+
pry-byebug (3.3.0)
|
40
|
+
byebug (~> 8.0)
|
41
41
|
pry (~> 0.10)
|
42
42
|
rake (10.4.2)
|
43
43
|
rdoc (4.2.0)
|
@@ -49,29 +49,30 @@ GEM
|
|
49
49
|
rspec-core (~> 3.3.0)
|
50
50
|
rspec-expectations (~> 3.3.0)
|
51
51
|
rspec-mocks (~> 3.3.0)
|
52
|
-
rspec-core (3.3.
|
52
|
+
rspec-core (3.3.2)
|
53
53
|
rspec-support (~> 3.3.0)
|
54
|
-
rspec-expectations (3.3.
|
54
|
+
rspec-expectations (3.3.1)
|
55
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
56
56
|
rspec-support (~> 3.3.0)
|
57
|
-
rspec-mocks (3.3.
|
57
|
+
rspec-mocks (3.3.2)
|
58
58
|
diff-lcs (>= 1.2.0, < 2.0)
|
59
59
|
rspec-support (~> 3.3.0)
|
60
60
|
rspec-support (3.3.0)
|
61
|
-
|
61
|
+
safe_yaml (1.0.4)
|
62
|
+
simplecov (0.11.1)
|
62
63
|
docile (~> 1.1.0)
|
63
64
|
json (~> 1.8)
|
64
65
|
simplecov-html (~> 0.10.0)
|
65
66
|
simplecov-html (0.10.0)
|
66
67
|
slop (3.6.0)
|
67
|
-
term-ansicolor (1.3.
|
68
|
+
term-ansicolor (1.3.2)
|
68
69
|
tins (~> 1.0)
|
69
70
|
thor (0.19.1)
|
70
|
-
tins (1.
|
71
|
+
tins (1.6.0)
|
71
72
|
unf (0.1.4)
|
72
73
|
unf_ext
|
73
74
|
unf_ext (0.0.7.1)
|
74
|
-
vcr (2.
|
75
|
+
vcr (2.9.3)
|
75
76
|
webmock (1.9.3)
|
76
77
|
addressable (>= 2.2.7)
|
77
78
|
crack (>= 0.3.2)
|
@@ -92,3 +93,6 @@ DEPENDENCIES
|
|
92
93
|
simplecov (~> 0.10)
|
93
94
|
vcr (~> 2.4)
|
94
95
|
webmock (~> 1.9.3)
|
96
|
+
|
97
|
+
BUNDLED WITH
|
98
|
+
1.10.6
|
data/README.rdoc
CHANGED
@@ -52,7 +52,7 @@ This gem supports Ruby 2.1 and Ruby 2.2.
|
|
52
52
|
* {PUT /notifications/api/:uuid/}[https://app.passaporteweb.com.br/static/docs/notificacao.html#put-notifications-api-uuid] ==> PassaporteWeb::Notification#read!
|
53
53
|
* {DELETE /notifications/api/:uuid/}[https://app.passaporteweb.com.br/static/docs/notificacao.html#delete-notifications-api-uuid] ==> PassaporteWeb::Notification#destroy
|
54
54
|
* {Gerência de contas}[https://app.passaporteweb.com.br/static/docs/account_manager.html]
|
55
|
-
* {PUT /organizations/api/activate/}[https://app.passaporteweb.com.br/static/docs/account_manager.html#put-organizations-api-activate] ==>
|
55
|
+
* {PUT /organizations/api/activate/}[https://app.passaporteweb.com.br/static/docs/account_manager.html#put-organizations-api-activate] ==> PassaporteWeb::ServiceAccount#activate
|
56
56
|
* {GET /organizations/api/accounts/}[https://app.passaporteweb.com.br/static/docs/account_manager.html#get-organizations-api-accounts] ==> PassaporteWeb::ServiceAccount.find_all
|
57
57
|
* {GET /organizations/api/accounts/:uuid/}[https://app.passaporteweb.com.br/static/docs/account_manager.html#get-organizations-api-accounts-uuid] ==> PassaporteWeb::ServiceAccount.find
|
58
58
|
* {PUT /organizations/api/accounts/:uuid/}[https://app.passaporteweb.com.br/static/docs/account_manager.html#put-organizations-api-accounts-uuid] ==> PassaporteWeb::ServiceAccount#save
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
26
|
spec.add_dependency "rest-client", "~> 1.8.0"
|
27
|
-
spec.add_dependency "multi_json", "~> 1.
|
27
|
+
spec.add_dependency "multi_json", "~> 1.11"
|
28
28
|
|
29
29
|
spec.add_development_dependency "bundler", "~> 1.9"
|
30
30
|
spec.add_development_dependency "rake", "~> 10.4"
|
@@ -4,11 +4,11 @@ require 'spec_helper'
|
|
4
4
|
describe PassaporteWeb::Configuration do
|
5
5
|
|
6
6
|
it "should use the production PassaporteWeb URL by default" do
|
7
|
-
PassaporteWeb::Configuration.new.url.
|
7
|
+
expect(PassaporteWeb::Configuration.new.url).to eq('https://app.passaporteweb.com.br')
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should use a default user agent" do
|
11
|
-
PassaporteWeb::Configuration.new.user_agent.
|
11
|
+
expect(PassaporteWeb::Configuration.new.user_agent).to eq("PassaporteWeb Ruby Client v#{PassaporteWeb::VERSION}")
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should allow setting the configuration parameters' do
|
@@ -18,10 +18,10 @@ describe PassaporteWeb::Configuration do
|
|
18
18
|
config.application_token = 'some-app-token'
|
19
19
|
config.application_secret = 'some-app-secret'
|
20
20
|
|
21
|
-
config.url.
|
22
|
-
config.application_token.
|
23
|
-
config.application_secret.
|
24
|
-
config.user_token.
|
21
|
+
expect(config.url).to eq('http://sandbox.app.passaporteweb.com.br')
|
22
|
+
expect(config.application_token).to eq('some-app-token')
|
23
|
+
expect(config.application_secret).to eq('some-app-secret')
|
24
|
+
expect(config.user_token).to be_nil
|
25
25
|
end
|
26
26
|
|
27
27
|
describe "#application_credentials" do
|
@@ -29,7 +29,7 @@ describe PassaporteWeb::Configuration do
|
|
29
29
|
it "should return the HTTP Basic Auth header value for the application login" do
|
30
30
|
config.application_token = 'some-app-token'
|
31
31
|
config.application_secret = 'some-app-secret'
|
32
|
-
config.application_credentials.
|
32
|
+
expect(config.application_credentials).to eq('Basic c29tZS1hcHAtdG9rZW46c29tZS1hcHAtc2VjcmV0')
|
33
33
|
end
|
34
34
|
it "should require the application_token to be set" do
|
35
35
|
config.application_secret = 'some-app-secret'
|
@@ -45,7 +45,7 @@ describe PassaporteWeb::Configuration do
|
|
45
45
|
let(:config) { PassaporteWeb::Configuration.new }
|
46
46
|
it "should return the HTTP Basic Auth header value for the user login" do
|
47
47
|
config.user_token = 'some-user-token'
|
48
|
-
config.user_credentials.
|
48
|
+
expect(config.user_credentials).to eq('Basic OnNvbWUtdXNlci10b2tlbg==')
|
49
49
|
end
|
50
50
|
it "should require the user_token to be set" do
|
51
51
|
expect { config.user_credentials }.to raise_error(ArgumentError, 'user_token not set')
|
@@ -6,13 +6,13 @@ describe PassaporteWeb::Helpers do
|
|
6
6
|
describe ".meta_links_from_header" do
|
7
7
|
it "should return a hash from the link header string" do
|
8
8
|
link_header = "<http://sandbox.app.passaporteweb.com.br/organizations/api/accounts/?page=3&limit=3>; rel=next, <http://sandbox.app.passaporteweb.com.br/organizations/api/accounts/?page=1&limit=3>; rel=prev, <http://sandbox.app.passaporteweb.com.br/organizations/api/accounts/?page=123&limit=3>; rel=last, <http://sandbox.app.passaporteweb.com.br/organizations/api/accounts/?page=1&limit=3>; rel=first"
|
9
|
-
described_class.meta_links_from_header(link_header).
|
9
|
+
expect(described_class.meta_links_from_header(link_header)).to eq({
|
10
10
|
limit: 3,
|
11
11
|
next_page: 3,
|
12
12
|
prev_page: 1,
|
13
13
|
first_page: 1,
|
14
14
|
last_page: 123
|
15
|
-
}
|
15
|
+
})
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -20,14 +20,14 @@ describe PassaporteWeb::Helpers do
|
|
20
20
|
it "should convert a hash recursevely to a OpenStruct" do
|
21
21
|
hash = {a: 1, b: {c: 3, d: 4, e: {f: 6, g: 7}}}
|
22
22
|
os = described_class.convert_to_ostruct_recursive(hash)
|
23
|
-
os.
|
24
|
-
os.a.
|
25
|
-
os.b.
|
26
|
-
os.b.c.
|
27
|
-
os.b.d.
|
28
|
-
os.b.e.
|
29
|
-
os.b.e.f.
|
30
|
-
os.b.e.g.
|
23
|
+
expect(os).to be_instance_of(OpenStruct)
|
24
|
+
expect(os.a).to eq(1)
|
25
|
+
expect(os.b).to be_instance_of(OpenStruct)
|
26
|
+
expect(os.b.c).to eq(3)
|
27
|
+
expect(os.b.d).to eq(4)
|
28
|
+
expect(os.b.e).to be_instance_of(OpenStruct)
|
29
|
+
expect(os.b.e.f).to eq(6)
|
30
|
+
expect(os.b.e.g).to eq(7)
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -17,7 +17,7 @@ describe PassaporteWeb::Http do
|
|
17
17
|
|
18
18
|
describe ".get" do
|
19
19
|
it "should use RestClient.get with the supplied params and common options" do
|
20
|
-
RestClient.
|
20
|
+
expect(RestClient).to receive(:get).with(
|
21
21
|
'https://some/where/foo',
|
22
22
|
params: {spam: 'eggs'},
|
23
23
|
authorization: 'Basic c29tZS1hcHAtdG9rZW46c29tZS1hcHAtc2VjcmV0',
|
@@ -31,7 +31,7 @@ describe PassaporteWeb::Http do
|
|
31
31
|
|
32
32
|
describe ".custom_auth_get" do
|
33
33
|
it "should use RestClient.get with the supplied params and common options, but with the custom authorization" do
|
34
|
-
RestClient.
|
34
|
+
expect(RestClient).to receive(:get).with(
|
35
35
|
'https://some/where/foo',
|
36
36
|
params: {spam: 'eggs'},
|
37
37
|
authorization: 'Basic am9obkBkb2UuY29tOnRoZWJpcmRpc3RoZXdvcmQ=',
|
@@ -45,7 +45,7 @@ describe PassaporteWeb::Http do
|
|
45
45
|
|
46
46
|
describe ".delete" do
|
47
47
|
it "should use RestClient.delete with the supplied params and common options" do
|
48
|
-
RestClient.
|
48
|
+
expect(RestClient).to receive(:delete).with(
|
49
49
|
'https://some/where/foo',
|
50
50
|
params: {spam: 'eggs'},
|
51
51
|
authorization: 'Basic c29tZS1hcHAtdG9rZW46c29tZS1hcHAtc2VjcmV0',
|
@@ -59,7 +59,7 @@ describe PassaporteWeb::Http do
|
|
59
59
|
|
60
60
|
describe ".put" do
|
61
61
|
it "should use RestClient.get with the supplied params and common options, encoding body as json" do
|
62
|
-
RestClient.
|
62
|
+
expect(RestClient).to receive(:put).with(
|
63
63
|
'https://some/where/foo',
|
64
64
|
'{"hello":"world"}',
|
65
65
|
params: {spam: 'eggs'},
|
@@ -71,7 +71,7 @@ describe PassaporteWeb::Http do
|
|
71
71
|
described_class.put('/foo', {hello: 'world'}, {spam: 'eggs'})
|
72
72
|
end
|
73
73
|
it "should use RestClient.get with the supplied params and common options, with body already as json" do
|
74
|
-
RestClient.
|
74
|
+
expect(RestClient).to receive(:put).with(
|
75
75
|
'https://some/where/foo',
|
76
76
|
'{"hello":"world"}',
|
77
77
|
params: {spam: 'eggs'},
|
@@ -86,7 +86,7 @@ describe PassaporteWeb::Http do
|
|
86
86
|
|
87
87
|
describe ".post" do
|
88
88
|
it "should use RestClient.post with the supplied params and common options, encoding body as json" do
|
89
|
-
RestClient.
|
89
|
+
expect(RestClient).to receive(:post).with(
|
90
90
|
'https://some/where/foo',
|
91
91
|
'{"hello":"world"}',
|
92
92
|
params: {},
|
@@ -98,7 +98,7 @@ describe PassaporteWeb::Http do
|
|
98
98
|
described_class.post('/foo', {hello: 'world'})
|
99
99
|
end
|
100
100
|
it "should use RestClient.post with the supplied params and common options, with body already as json" do
|
101
|
-
RestClient.
|
101
|
+
expect(RestClient).to receive(:post).with(
|
102
102
|
'https://some/where/foo',
|
103
103
|
'{"hello":"world"}',
|
104
104
|
params: {},
|
@@ -20,60 +20,60 @@ describe PassaporteWeb::IdentityServiceAccount do
|
|
20
20
|
}
|
21
21
|
account = described_class.new(identity, attributes)
|
22
22
|
|
23
|
-
account.
|
24
|
-
account.
|
25
|
-
account.errors.
|
26
|
-
account.identity.
|
23
|
+
expect(account).to be_instance_of(described_class)
|
24
|
+
expect(account).not_to be_persisted
|
25
|
+
expect(account.errors).to be_empty
|
26
|
+
expect(account.identity).to eq(identity)
|
27
27
|
|
28
|
-
account.membership_details_url.
|
29
|
-
account.plan_slug.
|
30
|
-
account.roles.
|
31
|
-
account.url.
|
32
|
-
account.expiration.
|
33
|
-
account.service_data.
|
34
|
-
account.account_data.
|
35
|
-
account.add_member_url.
|
36
|
-
account.name.
|
37
|
-
account.uuid.
|
28
|
+
expect(account.membership_details_url).to eq('/organizations/api/accounts/859d3542-84d6-4909-b1bd-4f43c1312065/members/5e32f927-c4ab-404e-a91c-b2abc05afb56/')
|
29
|
+
expect(account.plan_slug).to eq('basic')
|
30
|
+
expect(account.roles).to eq(['user', 'admin'])
|
31
|
+
expect(account.url).to eq('/organizations/api/accounts/859d3542-84d6-4909-b1bd-4f43c1312065/')
|
32
|
+
expect(account.expiration).to eq('2014-05-01 00:00:00')
|
33
|
+
expect(account.service_data).to eq({"name" => "Identity Client","slug" => "identity_client"})
|
34
|
+
expect(account.account_data).to eq({"name" => "Investimentos","uuid" => "859d3542-84d6-4909-b1bd-4f43c1312065"})
|
35
|
+
expect(account.add_member_url).to eq('/organizations/api/accounts/859d3542-84d6-4909-b1bd-4f43c1312065/members/')
|
36
|
+
expect(account.name).to eq('Investimentos') # TODO ???
|
37
|
+
expect(account.uuid).to eq('859d3542-84d6-4909-b1bd-4f43c1312065') # TODO ???
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
describe ".find_all", vcr: true do
|
42
42
|
it "should find all service accounts the identity is associted to in the current authenticated application" do
|
43
43
|
accounts = described_class.find_all(identity)
|
44
|
-
accounts.size.
|
45
|
-
accounts.map { |a| a.instance_of?(described_class) }.uniq.
|
46
|
-
accounts.map { |a| a.persisted? }.uniq.
|
44
|
+
expect(accounts.size).to eq(9)
|
45
|
+
expect(accounts.map { |a| a.instance_of?(described_class) }.uniq).to eq([true])
|
46
|
+
expect(accounts.map { |a| a.persisted? }.uniq).to eq([true])
|
47
47
|
|
48
48
|
account = accounts[4]
|
49
|
-
account.errors.
|
50
|
-
account.identity.
|
51
|
-
account.membership_details_url.
|
52
|
-
account.plan_slug.
|
53
|
-
account.roles.
|
54
|
-
account.url.
|
55
|
-
account.expiration.
|
56
|
-
account.service_data.
|
57
|
-
account.account_data.
|
58
|
-
account.add_member_url.
|
59
|
-
account.name.
|
60
|
-
account.uuid.
|
49
|
+
expect(account.errors).to be_empty
|
50
|
+
expect(account.identity).to eq(identity)
|
51
|
+
expect(account.membership_details_url).to eq('/organizations/api/accounts/859d3542-84d6-4909-b1bd-4f43c1312065/members/5e32f927-c4ab-404e-a91c-b2abc05afb56/')
|
52
|
+
expect(account.plan_slug).to eq('basic')
|
53
|
+
expect(account.roles).to eq(['owner', 'foo,bar'])
|
54
|
+
expect(account.url).to eq('/organizations/api/accounts/859d3542-84d6-4909-b1bd-4f43c1312065/')
|
55
|
+
expect(account.expiration).to eq('2014-05-01 00:00:00')
|
56
|
+
expect(account.service_data).to eq({"name" => "Identity Client","slug" => "identity_client"})
|
57
|
+
expect(account.account_data).to eq({"name" => "Investimentos","uuid" => "859d3542-84d6-4909-b1bd-4f43c1312065"})
|
58
|
+
expect(account.add_member_url).to eq('/organizations/api/accounts/859d3542-84d6-4909-b1bd-4f43c1312065/members/')
|
59
|
+
expect(account.name).to eq('Investimentos')
|
60
|
+
expect(account.uuid).to eq('859d3542-84d6-4909-b1bd-4f43c1312065')
|
61
61
|
end
|
62
62
|
it "should include expired service accounts if asked to" do
|
63
63
|
accounts = described_class.find_all(identity, true)
|
64
|
-
accounts.size.
|
65
|
-
accounts.map { |a| a.expiration }.uniq.
|
64
|
+
expect(accounts.size).to eq(12)
|
65
|
+
expect(accounts.map { |a| a.expiration }.uniq).to eq([nil, "2013-04-02 00:00:00", "2014-05-01 00:00:00", "2013-04-18 00:00:00"])
|
66
66
|
end
|
67
67
|
it "should find only service accounts in which the identity has the supplied role" do
|
68
68
|
role = 'foo,bar'
|
69
69
|
accounts = described_class.find_all(identity, false, role)
|
70
|
-
accounts.size.
|
71
|
-
accounts.map { |a| a.roles.include?(role) }.uniq.
|
70
|
+
expect(accounts.size).to eq(1)
|
71
|
+
expect(accounts.map { |a| a.roles.include?(role) }.uniq).to eq([true])
|
72
72
|
end
|
73
73
|
it "should include other services is asked to" do
|
74
74
|
accounts = described_class.find_all(identity, false, nil, true)
|
75
|
-
accounts.size.
|
76
|
-
accounts.map { |a| a.expiration }.uniq.
|
75
|
+
expect(accounts.size).to eq(9)
|
76
|
+
expect(accounts.map { |a| a.expiration }.uniq).to eq([nil, "2014-05-01 00:00:00"])
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -88,18 +88,18 @@ describe PassaporteWeb::IdentityServiceAccount do
|
|
88
88
|
}
|
89
89
|
account = described_class.new(identity, attributes)
|
90
90
|
expect(account.save).to be_truthy
|
91
|
-
account.
|
91
|
+
expect(account).to be_persisted
|
92
92
|
|
93
|
-
account.plan_slug.
|
94
|
-
account.roles.
|
95
|
-
account.service_data.
|
96
|
-
account.account_data['name'].
|
97
|
-
account.account_data['uuid'].
|
98
|
-
account.name.
|
99
|
-
account.uuid.
|
100
|
-
account.url.
|
101
|
-
account.membership_details_url.
|
102
|
-
account.add_member_url.
|
93
|
+
expect(account.plan_slug).to eq('basic')
|
94
|
+
expect(account.roles).to eq(['owner'])
|
95
|
+
expect(account.service_data).to eq({"name" => "Identity Client","slug" => "identity_client"})
|
96
|
+
expect(account.account_data['name']).to eq('Conta Nova em Folha')
|
97
|
+
expect(account.account_data['uuid']).not_to be_nil
|
98
|
+
expect(account.name).to eq('Conta Nova em Folha')
|
99
|
+
expect(account.uuid).not_to be_nil
|
100
|
+
expect(account.url).not_to be_nil
|
101
|
+
expect(account.membership_details_url).not_to be_nil
|
102
|
+
expect(account.add_member_url).not_to be_nil
|
103
103
|
end
|
104
104
|
it "should create a new service account by uuid for the identity in the current authenticated application" do
|
105
105
|
pending 'pegar explicação com Vitor'
|
@@ -111,19 +111,19 @@ describe PassaporteWeb::IdentityServiceAccount do
|
|
111
111
|
uuid: account_uuid
|
112
112
|
}
|
113
113
|
account = described_class.new(identity, attributes)
|
114
|
-
account.save.
|
115
|
-
account.
|
114
|
+
expect(account.save).to be_truthy
|
115
|
+
expect(account).to be_persisted
|
116
116
|
|
117
|
-
account.plan_slug.
|
118
|
-
account.roles.
|
119
|
-
account.service_data.
|
120
|
-
account.account_data['name'].
|
121
|
-
account.account_data['uuid'].
|
122
|
-
account.name.
|
123
|
-
account.uuid.
|
124
|
-
account.url.
|
125
|
-
account.membership_details_url.
|
126
|
-
account.add_member_url.
|
117
|
+
expect(account.plan_slug).to eq('basic')
|
118
|
+
expect(account.roles).to eq(['owner'])
|
119
|
+
expect(account.service_data).to eq({"name" => "Identity Client","slug" => "identity_client"})
|
120
|
+
expect(account.account_data['name']).not_to be_nil
|
121
|
+
expect(account.account_data['uuid']).to eq(account_uuid)
|
122
|
+
expect(account.name).not_to be_nil
|
123
|
+
expect(account.uuid).to eq(account_uuid)
|
124
|
+
expect(account.url).not_to be_nil
|
125
|
+
expect(account.membership_details_url).not_to be_nil
|
126
|
+
expect(account.add_member_url).not_to be_nil
|
127
127
|
end
|
128
128
|
end
|
129
129
|
context "on failure" do
|
@@ -136,8 +136,8 @@ describe PassaporteWeb::IdentityServiceAccount do
|
|
136
136
|
}
|
137
137
|
account = described_class.new(identity, attributes)
|
138
138
|
expect(account.save).to be_falsy
|
139
|
-
account.
|
140
|
-
account.errors.
|
139
|
+
expect(account).not_to be_persisted
|
140
|
+
expect(account.errors).to eq({"field_errors"=>{"expiration"=>["Cannot set the expiration to the past."]}})
|
141
141
|
end
|
142
142
|
end
|
143
143
|
end
|