authlete 1.37.0 → 1.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/authlete.gemspec +1 -2
- data/lib/authlete/model/service.rb +7 -1
- data/lib/authlete/version.rb +1 -1
- metadata +7 -170
- data/test/authlete/model/request/test_authentication-callback-request.rb +0 -100
- data/test/authlete/model/request/test_authorization-fail-request.rb +0 -67
- data/test/authlete/model/request/test_authorization-issue-request.rb +0 -94
- data/test/authlete/model/request/test_authorization-request.rb +0 -57
- data/test/authlete/model/request/test_backchannel-authentication-complete-request.rb +0 -102
- data/test/authlete/model/request/test_backchannel-authentication-fail-request.rb +0 -71
- data/test/authlete/model/request/test_backchannel-authentication-issue-request.rb +0 -57
- data/test/authlete/model/request/test_backchannel-authentication-request.rb +0 -75
- data/test/authlete/model/request/test_client-authorization-delete-request.rb +0 -57
- data/test/authlete/model/request/test_client-authorization-get-list-request.rb +0 -71
- data/test/authlete/model/request/test_client-authorization-update-request.rb +0 -63
- data/test/authlete/model/request/test_client-registration-request.rb +0 -68
- data/test/authlete/model/request/test_device-authorization-request.rb +0 -75
- data/test/authlete/model/request/test_device-complete-request.rb +0 -102
- data/test/authlete/model/request/test_device-verification-request.rb +0 -57
- data/test/authlete/model/request/test_granted-scopes-request.rb +0 -57
- data/test/authlete/model/request/test_introspection-request.rb +0 -79
- data/test/authlete/model/request/test_pushed-auth-req-request.rb +0 -75
- data/test/authlete/model/request/test_revocation-request.rb +0 -67
- data/test/authlete/model/request/test_standard-introspection-request.rb +0 -57
- data/test/authlete/model/request/test_token-create-request.rb +0 -110
- data/test/authlete/model/request/test_token-fail-request.rb +0 -63
- data/test/authlete/model/request/test_token-issue-request.rb +0 -70
- data/test/authlete/model/request/test_token-request.rb +0 -94
- data/test/authlete/model/request/test_token-revoke-request.rb +0 -71
- data/test/authlete/model/request/test_token-update-request.rb +0 -82
- data/test/authlete/model/request/test_user-info-issue-request.rb +0 -67
- data/test/authlete/model/request/test_user-info-request.rb +0 -75
- data/test/authlete/model/response/test_access-token.rb +0 -101
- data/test/authlete/model/response/test_authorization-fail-response.rb +0 -68
- data/test/authlete/model/response/test_authorization-issue-response.rb +0 -92
- data/test/authlete/model/response/test_authorization-response.rb +0 -145
- data/test/authlete/model/response/test_authorized-client-list-response.rb +0 -83
- data/test/authlete/model/response/test_backchannel-authentication-complete-response.rb +0 -132
- data/test/authlete/model/response/test_backchannel-authentication-fail-response.rb +0 -68
- data/test/authlete/model/response/test_backchannel-authentication-issue-response.rb +0 -80
- data/test/authlete/model/response/test_backchannel-authentication-response.rb +0 -156
- data/test/authlete/model/response/test_client-list-response.rb +0 -79
- data/test/authlete/model/response/test_client-secret-refresh-response.rb +0 -68
- data/test/authlete/model/response/test_client-secret-update-response.rb +0 -68
- data/test/authlete/model/response/test_device-authorization-response.rb +0 -140
- data/test/authlete/model/response/test_device-complete-response.rb +0 -64
- data/test/authlete/model/response/test_device-verification-response.rb +0 -112
- data/test/authlete/model/response/test_granted-scopes-get-response.rb +0 -84
- data/test/authlete/model/response/test_introspection-response.rb +0 -127
- data/test/authlete/model/response/test_pushed-auth-req-response.rb +0 -76
- data/test/authlete/model/response/test_revocation-response.rb +0 -68
- data/test/authlete/model/response/test_service-list-response.rb +0 -72
- data/test/authlete/model/response/test_standard-introspection-response.rb +0 -68
- data/test/authlete/model/response/test_token-create-response.rb +0 -107
- data/test/authlete/model/response/test_token-fail-response.rb +0 -68
- data/test/authlete/model/response/test_token-issue-response.rb +0 -127
- data/test/authlete/model/response/test_token-list-response.rb +0 -84
- data/test/authlete/model/response/test_token-response.rb +0 -147
- data/test/authlete/model/response/test_token-revoke-response.rb +0 -63
- data/test/authlete/model/response/test_token-update-response.rb +0 -87
- data/test/authlete/model/response/test_user-info-issue-response.rb +0 -68
- data/test/authlete/model/response/test_user-info-response.rb +0 -107
- data/test/authlete/model/test_client-extension.rb +0 -98
- data/test/authlete/model/test_client.rb +0 -604
- data/test/authlete/model/test_hsk.rb +0 -108
- data/test/authlete/model/test_named-uri.rb +0 -83
- data/test/authlete/model/test_pair.rb +0 -83
- data/test/authlete/model/test_property.rb +0 -88
- data/test/authlete/model/test_result.rb +0 -68
- data/test/authlete/model/test_scope.rb +0 -104
- data/test/authlete/model/test_service-owner.rb +0 -80
- data/test/authlete/model/test_service.rb +0 -896
- data/test/authlete/model/test_sns-credentials.rb +0 -88
- data/test/authlete/model/test_tagged-value.rb +0 -83
- data/test/authlete/model/test_trust-anchor.rb +0 -84
- data/test/authlete/test_exception.rb +0 -70
- data/test/authlete/types/test_application-type.rb +0 -44
- data/test/authlete/types/test_client-auth-method.rb +0 -64
- data/test/authlete/types/test_delivery-mode.rb +0 -48
- data/test/authlete/types/test_grant-type.rb +0 -72
- data/test/authlete/types/test_jwealg.rb +0 -104
- data/test/authlete/types/test_jweenc.rb +0 -60
- data/test/authlete/types/test_jwsalg.rb +0 -96
- data/test/authlete/types/test_response-type.rb +0 -68
- data/test/authlete/types/test_subject-type.rb +0 -44
@@ -1,108 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2014-2021 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'json'
|
20
|
-
require 'minitest/autorun'
|
21
|
-
|
22
|
-
|
23
|
-
class HskTest < Minitest::Test
|
24
|
-
KTY = 'EC'
|
25
|
-
USE = 'sig'
|
26
|
-
ALG = 'ES256'
|
27
|
-
KID = 'jane'
|
28
|
-
HSM_NAME = 'google'
|
29
|
-
HANDLE = '<handle>'
|
30
|
-
PUBLIC_KEY = '<public-key>'
|
31
|
-
|
32
|
-
|
33
|
-
def generate_json
|
34
|
-
return <<~JSON
|
35
|
-
{
|
36
|
-
"kty": "EC",
|
37
|
-
"use": "sig",
|
38
|
-
"alg": "ES256",
|
39
|
-
"kid": "jane",
|
40
|
-
"hsmName": "google",
|
41
|
-
"handle": "<handle>",
|
42
|
-
"publicKey": "<public-key>"
|
43
|
-
}
|
44
|
-
JSON
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
def generate_hash
|
49
|
-
{
|
50
|
-
kty: 'EC',
|
51
|
-
use: 'sig',
|
52
|
-
alg: 'ES256',
|
53
|
-
kid: 'jane',
|
54
|
-
hsmName: 'google',
|
55
|
-
handle: '<handle>',
|
56
|
-
publicKey: '<public-key>'
|
57
|
-
}
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
def set_params(obj)
|
62
|
-
obj.kty = KTY
|
63
|
-
obj.use = USE
|
64
|
-
obj.alg = ALG
|
65
|
-
obj.kid = KID
|
66
|
-
obj.hsmName = HSM_NAME
|
67
|
-
obj.handle = HANDLE
|
68
|
-
obj.publicKey = PUBLIC_KEY
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
def match(obj)
|
73
|
-
assert_equal KTY, obj.kty
|
74
|
-
assert_equal USE, obj.use
|
75
|
-
assert_equal ALG, obj.alg
|
76
|
-
assert_equal KID, obj.kid
|
77
|
-
assert_equal HSM_NAME, obj.hsmName
|
78
|
-
assert_equal HANDLE, obj.handle
|
79
|
-
assert_equal PUBLIC_KEY, obj.publicKey
|
80
|
-
end
|
81
|
-
|
82
|
-
|
83
|
-
def test_from_json
|
84
|
-
jsn = generate_json
|
85
|
-
hsh = JSON.parse(jsn)
|
86
|
-
actual = Authlete::Model::Hsk.new(hsh)
|
87
|
-
|
88
|
-
match(actual)
|
89
|
-
end
|
90
|
-
|
91
|
-
|
92
|
-
def test_setters
|
93
|
-
actual = Authlete::Model::Hsk.new
|
94
|
-
set_params(actual)
|
95
|
-
|
96
|
-
match(actual)
|
97
|
-
end
|
98
|
-
|
99
|
-
|
100
|
-
def test_to_hash
|
101
|
-
obj = Authlete::Model::Hsk.new
|
102
|
-
set_params(obj)
|
103
|
-
actual = obj.to_hash
|
104
|
-
expected = generate_hash
|
105
|
-
|
106
|
-
assert_equal expected, actual
|
107
|
-
end
|
108
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'json'
|
20
|
-
require 'minitest/autorun'
|
21
|
-
|
22
|
-
|
23
|
-
class NamedUriTest < Minitest::Test
|
24
|
-
NAME = '<name>'
|
25
|
-
URI = '<uri>'
|
26
|
-
|
27
|
-
|
28
|
-
def generate_json
|
29
|
-
return <<~JSON
|
30
|
-
{
|
31
|
-
"name": "<name>",
|
32
|
-
"uri": "<uri>"
|
33
|
-
}
|
34
|
-
JSON
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
def generate_hash
|
39
|
-
{
|
40
|
-
name: '<name>',
|
41
|
-
uri: '<uri>'
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
def set_params(obj)
|
47
|
-
obj.name = NAME
|
48
|
-
obj.uri = URI
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
def match(obj)
|
53
|
-
assert_equal NAME, obj.name
|
54
|
-
assert_equal URI, obj.uri
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
def test_from_json
|
59
|
-
jsn = generate_json
|
60
|
-
hsh = JSON.parse(jsn)
|
61
|
-
actual = Authlete::Model::NamedUri.new(hsh)
|
62
|
-
|
63
|
-
match(actual)
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
def test_setters
|
68
|
-
actual = Authlete::Model::NamedUri.new
|
69
|
-
set_params(actual)
|
70
|
-
|
71
|
-
match(actual)
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
def test_to_hash
|
76
|
-
obj = Authlete::Model::NamedUri.new
|
77
|
-
set_params(obj)
|
78
|
-
actual = obj.to_hash
|
79
|
-
expected = generate_hash
|
80
|
-
|
81
|
-
assert_equal expected, actual
|
82
|
-
end
|
83
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'json'
|
20
|
-
require 'minitest/autorun'
|
21
|
-
|
22
|
-
|
23
|
-
class PairTest < Minitest::Test
|
24
|
-
KEY = '<key>'
|
25
|
-
VALUE = '<value>'
|
26
|
-
|
27
|
-
|
28
|
-
def generate_json
|
29
|
-
return <<~JSON
|
30
|
-
{
|
31
|
-
"key": "<key>",
|
32
|
-
"value": "<value>"
|
33
|
-
}
|
34
|
-
JSON
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
def generate_hash
|
39
|
-
{
|
40
|
-
key: '<key>',
|
41
|
-
value: '<value>'
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
def set_params(obj)
|
47
|
-
obj.key = KEY
|
48
|
-
obj.value = VALUE
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
def match(obj)
|
53
|
-
assert_equal KEY, obj.key
|
54
|
-
assert_equal VALUE, obj.value
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
def test_from_json
|
59
|
-
jsn = generate_json
|
60
|
-
hsh = JSON.parse(jsn)
|
61
|
-
actual = Authlete::Model::Pair.new(hsh)
|
62
|
-
|
63
|
-
match(actual)
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
def test_setters
|
68
|
-
actual = Authlete::Model::Pair.new
|
69
|
-
set_params(actual)
|
70
|
-
|
71
|
-
match(actual)
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
def test_to_hash
|
76
|
-
obj = Authlete::Model::Pair.new
|
77
|
-
set_params(obj)
|
78
|
-
actual = obj.to_hash
|
79
|
-
expected = generate_hash
|
80
|
-
|
81
|
-
assert_equal expected, actual
|
82
|
-
end
|
83
|
-
end
|
@@ -1,88 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'json'
|
20
|
-
require 'minitest/autorun'
|
21
|
-
|
22
|
-
|
23
|
-
class PropertyTest < Minitest::Test
|
24
|
-
KEY = '<key>'
|
25
|
-
VALUE = '<value>'
|
26
|
-
HIDDEN = false
|
27
|
-
|
28
|
-
|
29
|
-
def generate_json
|
30
|
-
return <<~JSON
|
31
|
-
{
|
32
|
-
"key": "<key>",
|
33
|
-
"value": "<value>",
|
34
|
-
"hidden": false
|
35
|
-
}
|
36
|
-
JSON
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
def generate_hash
|
41
|
-
{
|
42
|
-
key: '<key>',
|
43
|
-
value: '<value>',
|
44
|
-
hidden: false
|
45
|
-
}
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
def set_params(obj)
|
50
|
-
obj.key = KEY
|
51
|
-
obj.value = VALUE
|
52
|
-
obj.hidden = HIDDEN
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
def match(obj)
|
57
|
-
assert_equal KEY, obj.key
|
58
|
-
assert_equal VALUE, obj.value
|
59
|
-
assert_equal HIDDEN, obj.hidden
|
60
|
-
end
|
61
|
-
|
62
|
-
|
63
|
-
def test_from_json
|
64
|
-
jsn = generate_json
|
65
|
-
hsh = JSON.parse(jsn)
|
66
|
-
actual = Authlete::Model::Property.new(hsh)
|
67
|
-
|
68
|
-
match(actual)
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
def test_setters
|
73
|
-
actual = Authlete::Model::Property.new
|
74
|
-
set_params(actual)
|
75
|
-
|
76
|
-
match(actual)
|
77
|
-
end
|
78
|
-
|
79
|
-
|
80
|
-
def test_to_hash
|
81
|
-
obj = Authlete::Model::Property.new
|
82
|
-
set_params(obj)
|
83
|
-
actual = obj.to_hash
|
84
|
-
expected = generate_hash
|
85
|
-
|
86
|
-
assert_equal expected, actual
|
87
|
-
end
|
88
|
-
end
|
@@ -1,68 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'json'
|
20
|
-
require 'minitest/autorun'
|
21
|
-
|
22
|
-
|
23
|
-
class ResultTest < Minitest::Test
|
24
|
-
RESULT_CODE = '<result-code>'
|
25
|
-
RESULT_MESSAGE = '<result-message>'
|
26
|
-
|
27
|
-
|
28
|
-
def generate_json
|
29
|
-
return <<~JSON
|
30
|
-
{
|
31
|
-
"resultCode": "<result-code>",
|
32
|
-
"resultMessage": "<result-message>"
|
33
|
-
}
|
34
|
-
JSON
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
def generate_hash
|
39
|
-
{
|
40
|
-
resultCode: '<result-code>',
|
41
|
-
resultMessage: '<result-message>'
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
def match(obj)
|
47
|
-
assert_equal RESULT_CODE, obj.resultCode
|
48
|
-
assert_equal RESULT_MESSAGE, obj.resultMessage
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
def test_from_json
|
53
|
-
jsn = generate_json
|
54
|
-
hsh = JSON.parse(jsn)
|
55
|
-
actual = Authlete::Model::Result.new(hsh)
|
56
|
-
|
57
|
-
match(actual)
|
58
|
-
end
|
59
|
-
|
60
|
-
|
61
|
-
def test_setters
|
62
|
-
actual = Authlete::Model::Result.new
|
63
|
-
actual.resultCode = RESULT_CODE
|
64
|
-
actual.resultMessage = RESULT_MESSAGE
|
65
|
-
|
66
|
-
match(actual)
|
67
|
-
end
|
68
|
-
end
|
@@ -1,104 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'json'
|
20
|
-
require 'minitest/autorun'
|
21
|
-
|
22
|
-
|
23
|
-
class ScopeTest < Minitest::Test
|
24
|
-
NAME = '<name>'
|
25
|
-
DEFAULT_ENTRY = true
|
26
|
-
DESCRIPTION = '<description>'
|
27
|
-
DESCRIPTION_TAG = '<description0-tag>'
|
28
|
-
DESCRIPTION_VALUE = '<description0-value>'
|
29
|
-
DESCRIPTIONS = [ Authlete::Model::TaggedValue.new(tag: DESCRIPTION_TAG, value: DESCRIPTION_VALUE) ]
|
30
|
-
ATTRIBUTE_KEY = '<attribute0-key>'
|
31
|
-
ATTRIBUTE_VALUE = '<attribute0-value>'
|
32
|
-
ATTRIBUTES = [ Authlete::Model::Pair.new(key: ATTRIBUTE_KEY, value: ATTRIBUTE_VALUE) ]
|
33
|
-
|
34
|
-
|
35
|
-
def generate_json
|
36
|
-
return <<~JSON
|
37
|
-
{
|
38
|
-
"name": "<name>",
|
39
|
-
"defaultEntry": true,
|
40
|
-
"description": "<description>",
|
41
|
-
"descriptions": [ { "tag": "<description0-tag>", "value": "<description0-value>" } ],
|
42
|
-
"attributes": [ { "key": "<attribute0-key>", "value": "<attribute0-value>" } ]
|
43
|
-
}
|
44
|
-
JSON
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
def generate_hash
|
49
|
-
{
|
50
|
-
name: '<name>',
|
51
|
-
defaultEntry: true,
|
52
|
-
description: '<description>',
|
53
|
-
descriptions: [ { tag: '<description0-tag>', value: '<description0-value>' } ],
|
54
|
-
attributes: [ { key: '<attribute0-key>', value: '<attribute0-value>' } ]
|
55
|
-
}
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
|
-
def set_params(obj)
|
60
|
-
obj.name = NAME
|
61
|
-
obj.default_entry = DEFAULT_ENTRY
|
62
|
-
obj.description = DESCRIPTION
|
63
|
-
obj.descriptions = DESCRIPTIONS
|
64
|
-
obj.attributes = ATTRIBUTES
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
def match(obj)
|
69
|
-
assert_equal NAME, obj.name
|
70
|
-
assert_equal DEFAULT_ENTRY, obj.defaultEntry
|
71
|
-
assert_equal DESCRIPTION, obj.description
|
72
|
-
assert_equal DESCRIPTION_TAG, obj.descriptions[0].tag
|
73
|
-
assert_equal DESCRIPTION_VALUE, obj.descriptions[0].value
|
74
|
-
assert_equal ATTRIBUTE_KEY, obj.attributes[0].key
|
75
|
-
assert_equal ATTRIBUTE_VALUE, obj.attributes[0].value
|
76
|
-
end
|
77
|
-
|
78
|
-
|
79
|
-
def test_from_json
|
80
|
-
jsn = generate_json()
|
81
|
-
hsh = JSON.parse(jsn)
|
82
|
-
actual = Authlete::Model::Scope.new(hsh)
|
83
|
-
|
84
|
-
match(actual)
|
85
|
-
end
|
86
|
-
|
87
|
-
|
88
|
-
def test_setters
|
89
|
-
actual = Authlete::Model::Scope.new
|
90
|
-
set_params(actual)
|
91
|
-
|
92
|
-
match(actual)
|
93
|
-
end
|
94
|
-
|
95
|
-
|
96
|
-
def test_to_hash
|
97
|
-
obj = Authlete::Model::Scope.new
|
98
|
-
set_params(obj)
|
99
|
-
actual = obj.to_hash
|
100
|
-
expected = generate_hash
|
101
|
-
|
102
|
-
assert_equal expected, actual
|
103
|
-
end
|
104
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'json'
|
20
|
-
require 'minitest/autorun'
|
21
|
-
|
22
|
-
|
23
|
-
class ServiceOwnerTest < Minitest::Test
|
24
|
-
NUMBER = 12345
|
25
|
-
NAME = '<name>'
|
26
|
-
EMAIL = '<email>'
|
27
|
-
LOGIN_ID = '<login-id>'
|
28
|
-
API_KEY = '<api-key>'
|
29
|
-
API_SECRET = '<api-secret>'
|
30
|
-
PLAN = 'FREE'
|
31
|
-
|
32
|
-
|
33
|
-
def generate_json
|
34
|
-
return <<~JSON
|
35
|
-
{
|
36
|
-
"number": 12345,
|
37
|
-
"name": "<name>",
|
38
|
-
"email": "<email>",
|
39
|
-
"loginId": "<login-id>",
|
40
|
-
"apiKey": "<api-key>",
|
41
|
-
"apiSecret": "<api-secret>",
|
42
|
-
"plan": "FREE"
|
43
|
-
}
|
44
|
-
JSON
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
def match(obj)
|
49
|
-
assert_equal NUMBER, obj.number
|
50
|
-
assert_equal NAME, obj.name
|
51
|
-
assert_equal EMAIL, obj.email
|
52
|
-
assert_equal LOGIN_ID, obj.loginId
|
53
|
-
assert_equal API_KEY, obj.apiKey
|
54
|
-
assert_equal API_SECRET, obj.apiSecret
|
55
|
-
assert_equal PLAN, obj.plan
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
|
-
def test_from_json
|
60
|
-
jsn = generate_json
|
61
|
-
hsh = JSON.parse(jsn)
|
62
|
-
obj = Authlete::Model::ServiceOwner.new(hsh)
|
63
|
-
|
64
|
-
match(obj)
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
def test_setters
|
69
|
-
actual = Authlete::Model::ServiceOwner.new
|
70
|
-
actual.number = NUMBER
|
71
|
-
actual.name = NAME
|
72
|
-
actual.email = EMAIL
|
73
|
-
actual.login_id = LOGIN_ID
|
74
|
-
actual.api_key = API_KEY
|
75
|
-
actual.api_secret = API_SECRET
|
76
|
-
actual.plan = PLAN
|
77
|
-
|
78
|
-
match(actual)
|
79
|
-
end
|
80
|
-
end
|