authlete 1.38.0 → 1.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +5 -5
  2. data/authlete.gemspec +1 -2
  3. data/lib/authlete/model/service.rb +7 -1
  4. data/lib/authlete/version.rb +1 -1
  5. metadata +7 -170
  6. data/test/authlete/model/request/test_authentication-callback-request.rb +0 -100
  7. data/test/authlete/model/request/test_authorization-fail-request.rb +0 -67
  8. data/test/authlete/model/request/test_authorization-issue-request.rb +0 -94
  9. data/test/authlete/model/request/test_authorization-request.rb +0 -57
  10. data/test/authlete/model/request/test_backchannel-authentication-complete-request.rb +0 -102
  11. data/test/authlete/model/request/test_backchannel-authentication-fail-request.rb +0 -71
  12. data/test/authlete/model/request/test_backchannel-authentication-issue-request.rb +0 -57
  13. data/test/authlete/model/request/test_backchannel-authentication-request.rb +0 -75
  14. data/test/authlete/model/request/test_client-authorization-delete-request.rb +0 -57
  15. data/test/authlete/model/request/test_client-authorization-get-list-request.rb +0 -71
  16. data/test/authlete/model/request/test_client-authorization-update-request.rb +0 -63
  17. data/test/authlete/model/request/test_client-registration-request.rb +0 -68
  18. data/test/authlete/model/request/test_device-authorization-request.rb +0 -75
  19. data/test/authlete/model/request/test_device-complete-request.rb +0 -102
  20. data/test/authlete/model/request/test_device-verification-request.rb +0 -57
  21. data/test/authlete/model/request/test_granted-scopes-request.rb +0 -57
  22. data/test/authlete/model/request/test_introspection-request.rb +0 -79
  23. data/test/authlete/model/request/test_pushed-auth-req-request.rb +0 -75
  24. data/test/authlete/model/request/test_revocation-request.rb +0 -67
  25. data/test/authlete/model/request/test_standard-introspection-request.rb +0 -57
  26. data/test/authlete/model/request/test_token-create-request.rb +0 -110
  27. data/test/authlete/model/request/test_token-fail-request.rb +0 -63
  28. data/test/authlete/model/request/test_token-issue-request.rb +0 -70
  29. data/test/authlete/model/request/test_token-request.rb +0 -94
  30. data/test/authlete/model/request/test_token-revoke-request.rb +0 -71
  31. data/test/authlete/model/request/test_token-update-request.rb +0 -82
  32. data/test/authlete/model/request/test_user-info-issue-request.rb +0 -67
  33. data/test/authlete/model/request/test_user-info-request.rb +0 -75
  34. data/test/authlete/model/response/test_access-token.rb +0 -101
  35. data/test/authlete/model/response/test_authorization-fail-response.rb +0 -68
  36. data/test/authlete/model/response/test_authorization-issue-response.rb +0 -92
  37. data/test/authlete/model/response/test_authorization-response.rb +0 -145
  38. data/test/authlete/model/response/test_authorized-client-list-response.rb +0 -83
  39. data/test/authlete/model/response/test_backchannel-authentication-complete-response.rb +0 -132
  40. data/test/authlete/model/response/test_backchannel-authentication-fail-response.rb +0 -68
  41. data/test/authlete/model/response/test_backchannel-authentication-issue-response.rb +0 -80
  42. data/test/authlete/model/response/test_backchannel-authentication-response.rb +0 -156
  43. data/test/authlete/model/response/test_client-list-response.rb +0 -79
  44. data/test/authlete/model/response/test_client-secret-refresh-response.rb +0 -68
  45. data/test/authlete/model/response/test_client-secret-update-response.rb +0 -68
  46. data/test/authlete/model/response/test_device-authorization-response.rb +0 -140
  47. data/test/authlete/model/response/test_device-complete-response.rb +0 -64
  48. data/test/authlete/model/response/test_device-verification-response.rb +0 -112
  49. data/test/authlete/model/response/test_granted-scopes-get-response.rb +0 -84
  50. data/test/authlete/model/response/test_introspection-response.rb +0 -127
  51. data/test/authlete/model/response/test_pushed-auth-req-response.rb +0 -76
  52. data/test/authlete/model/response/test_revocation-response.rb +0 -68
  53. data/test/authlete/model/response/test_service-list-response.rb +0 -72
  54. data/test/authlete/model/response/test_standard-introspection-response.rb +0 -68
  55. data/test/authlete/model/response/test_token-create-response.rb +0 -107
  56. data/test/authlete/model/response/test_token-fail-response.rb +0 -68
  57. data/test/authlete/model/response/test_token-issue-response.rb +0 -127
  58. data/test/authlete/model/response/test_token-list-response.rb +0 -84
  59. data/test/authlete/model/response/test_token-response.rb +0 -147
  60. data/test/authlete/model/response/test_token-revoke-response.rb +0 -63
  61. data/test/authlete/model/response/test_token-update-response.rb +0 -87
  62. data/test/authlete/model/response/test_user-info-issue-response.rb +0 -68
  63. data/test/authlete/model/response/test_user-info-response.rb +0 -107
  64. data/test/authlete/model/test_client-extension.rb +0 -98
  65. data/test/authlete/model/test_client.rb +0 -604
  66. data/test/authlete/model/test_hsk.rb +0 -108
  67. data/test/authlete/model/test_named-uri.rb +0 -83
  68. data/test/authlete/model/test_pair.rb +0 -83
  69. data/test/authlete/model/test_property.rb +0 -88
  70. data/test/authlete/model/test_result.rb +0 -68
  71. data/test/authlete/model/test_scope.rb +0 -104
  72. data/test/authlete/model/test_service-owner.rb +0 -80
  73. data/test/authlete/model/test_service.rb +0 -896
  74. data/test/authlete/model/test_sns-credentials.rb +0 -88
  75. data/test/authlete/model/test_tagged-value.rb +0 -83
  76. data/test/authlete/model/test_trust-anchor.rb +0 -84
  77. data/test/authlete/test_exception.rb +0 -70
  78. data/test/authlete/types/test_application-type.rb +0 -44
  79. data/test/authlete/types/test_client-auth-method.rb +0 -64
  80. data/test/authlete/types/test_delivery-mode.rb +0 -48
  81. data/test/authlete/types/test_grant-type.rb +0 -72
  82. data/test/authlete/types/test_jwealg.rb +0 -104
  83. data/test/authlete/types/test_jweenc.rb +0 -60
  84. data/test/authlete/types/test_jwsalg.rb +0 -96
  85. data/test/authlete/types/test_response-type.rb +0 -68
  86. data/test/authlete/types/test_subject-type.rb +0 -44
@@ -1,84 +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 GrantedScopesGetResponseTest < Minitest::Test
24
- RESULT_CODE = '<result-code>'
25
- RESULT_MESSAGE = '<result-message>'
26
- SERVICE_API_KEY = '<service-api-key>'
27
- CLIENT_ID = 12345
28
- SUBJECT = '<subject>'
29
- LATEST_GRANTED_SCOPES = [ 'latest-granted-scope0' ]
30
- MERGED_GRANTED_SCOPES = [ 'merged-granted-scope0' ]
31
- MODIFIED_AT = 1000
32
-
33
-
34
- def generate_json
35
- return <<~JSON
36
- {
37
- "resultCode": "<result-code>",
38
- "resultMessage": "<result-message>",
39
- "serviceApiKey": "<service-api-key>",
40
- "clientId": 12345,
41
- "subject": "<subject>",
42
- "latestGrantedScopes": [ "latest-granted-scope0" ],
43
- "mergedGrantedScopes": [ "merged-granted-scope0" ],
44
- "modifiedAt": 1000
45
- }
46
- JSON
47
- end
48
-
49
-
50
- def match(obj)
51
- assert_equal RESULT_CODE, obj.resultCode
52
- assert_equal RESULT_MESSAGE, obj.resultMessage
53
- assert_equal SERVICE_API_KEY, obj.serviceApiKey
54
- assert_equal CLIENT_ID, obj.clientId
55
- assert_equal SUBJECT, obj.subject
56
- assert_equal LATEST_GRANTED_SCOPES, obj.latestGrantedScopes
57
- assert_equal MERGED_GRANTED_SCOPES, obj.mergedGrantedScopes
58
- assert_equal MODIFIED_AT, obj.modifiedAt
59
- end
60
-
61
-
62
- def test_from_json
63
- jsn = generate_json
64
- hsh = JSON.parse(jsn)
65
- actual = Authlete::Model::Response::GrantedScopesGetResponse.new(hsh)
66
-
67
- match(actual)
68
- end
69
-
70
-
71
- def test_setters
72
- actual = Authlete::Model::Response::GrantedScopesGetResponse.new
73
- actual.result_code = RESULT_CODE
74
- actual.result_message = RESULT_MESSAGE
75
- actual.service_api_key = SERVICE_API_KEY
76
- actual.client_id = CLIENT_ID
77
- actual.subject = SUBJECT
78
- actual.latest_granted_scopes = LATEST_GRANTED_SCOPES
79
- actual.merged_granted_scopes = MERGED_GRANTED_SCOPES
80
- actual.modified_at = MODIFIED_AT
81
-
82
- match(actual)
83
- end
84
- end
@@ -1,127 +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 IntrospectionResponseTest < Minitest::Test
24
- RESULT_CODE = '<result-code>'
25
- RESULT_MESSAGE = '<result-message>'
26
- ACTION = 'OK'
27
- CLIENT_ID = 12345
28
- CLIENT_ID_ALIAS = '<client-id-alias>'
29
- CLIENT_ID_ALIAS_USED = false
30
- EXPIRES_AT = 1000
31
- SUBJECT = '<subject>'
32
- SCOPES = [ 'scope0', 'scope1' ]
33
- EXISTENT = true
34
- USABLE = true
35
- SUFFICIENT = true
36
- REFRESHABLE = true
37
- RESPONSE_CONTENT = '<response-content>'
38
- PROPERTY_KEY = '<property0-key>'
39
- PROPERTY_VALUE = '<property0-value>'
40
- PROPERTIES = [ Authlete::Model::Property.new(key: PROPERTY_KEY, value: PROPERTY_VALUE) ]
41
- CERTIFICATE_THUMBPRINT = '<certificate-thumbprint>'
42
- RESOURCES = [ 'resource0', 'resource1' ]
43
- ACCESS_TOKEN_RESOURCES = [ 'access-token-resource0', 'access-token-resource1' ]
44
-
45
-
46
- def generate_json
47
- return <<~JSON
48
- {
49
- "resultCode": "<result-code>",
50
- "resultMessage": "<result-message>",
51
- "action": "OK",
52
- "clientId": 12345,
53
- "clientIdAlias": "<client-id-alias>",
54
- "clientIdAliasUsed": false,
55
- "expiresAt": 1000,
56
- "subject": "<subject>",
57
- "scopes": [ "scope0", "scope1" ],
58
- "existent": true,
59
- "usable": true,
60
- "sufficient": true,
61
- "refreshable": true,
62
- "responseContent": "<response-content>",
63
- "properties": [ { "key": "<property0-key>", "value": "<property0-value>" } ],
64
- "certificateThumbprint" : "<certificate-thumbprint>",
65
- "resources": [ "resource0", "resource1" ],
66
- "accessTokenResources": [ "access-token-resource0", "access-token-resource1" ]
67
- }
68
- JSON
69
- end
70
-
71
-
72
- def match(obj)
73
- assert_equal RESULT_CODE, obj.resultCode
74
- assert_equal RESULT_MESSAGE, obj.resultMessage
75
- assert_equal ACTION, obj.action
76
- assert_equal CLIENT_ID, obj.clientId
77
- assert_equal CLIENT_ID_ALIAS, obj.clientIdAlias
78
- assert_equal CLIENT_ID_ALIAS_USED, obj.clientIdAliasUsed
79
- assert_equal EXPIRES_AT, obj.expiresAt
80
- assert_equal SUBJECT, obj.subject
81
- assert_equal SCOPES, obj.scopes
82
- assert_equal EXISTENT, obj.existent
83
- assert_equal USABLE, obj.usable
84
- assert_equal SUFFICIENT, obj.sufficient
85
- assert_equal REFRESHABLE, obj.refreshable
86
- assert_equal RESPONSE_CONTENT, obj.responseContent
87
- assert_equal PROPERTY_KEY, obj.properties[0].key
88
- assert_equal PROPERTY_VALUE, obj.properties[0].value
89
- assert_equal CERTIFICATE_THUMBPRINT, obj.certificateThumbprint
90
- assert_equal RESOURCES, obj.resources
91
- assert_equal ACCESS_TOKEN_RESOURCES, obj.accessTokenResources
92
- end
93
-
94
-
95
- def test_from_json
96
- jsn = generate_json
97
- hsh = JSON.parse(jsn)
98
- actual = Authlete::Model::Response::IntrospectionResponse.new(hsh)
99
-
100
- match(actual)
101
- end
102
-
103
-
104
- def test_setters
105
- actual = Authlete::Model::Response::IntrospectionResponse.new
106
- actual.result_code = RESULT_CODE
107
- actual.result_message = RESULT_MESSAGE
108
- actual.action = ACTION
109
- actual.client_id = CLIENT_ID
110
- actual.client_id_alias = CLIENT_ID_ALIAS
111
- actual.client_id_alias_used = CLIENT_ID_ALIAS_USED
112
- actual.expires_at = EXPIRES_AT
113
- actual.subject = SUBJECT
114
- actual.scopes = SCOPES
115
- actual.existent = EXISTENT
116
- actual.usable = USABLE
117
- actual.sufficient = SUFFICIENT
118
- actual.refreshable = REFRESHABLE
119
- actual.response_content = RESPONSE_CONTENT
120
- actual.properties = PROPERTIES
121
- actual.certificate_thumbprint = CERTIFICATE_THUMBPRINT
122
- actual.resources = RESOURCES
123
- actual.access_token_resources = ACCESS_TOKEN_RESOURCES
124
-
125
- match(actual)
126
- end
127
- end
@@ -1,76 +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 PushedAuthReqResponseTest < Minitest::Test
24
- RESULT_CODE = '<result-code>'
25
- RESULT_MESSAGE = '<result-message>'
26
- ACTION = 'OK'
27
- RESPONSE_CONTENT = '<response-content>'
28
- CLIENT_AUTH_METHOD = 'BASIC'
29
- REQUEST_URI = '<request-uri>'
30
-
31
-
32
- def generate_json
33
- return <<~JSON
34
- {
35
- "resultCode": "<result-code>",
36
- "resultMessage": "<result-message>",
37
- "action": "OK",
38
- "responseContent": "<response-content>",
39
- "clientAuthMethod": "BASIC",
40
- "requestUri": "<request-uri>"
41
- }
42
- JSON
43
- end
44
-
45
-
46
- def match(obj)
47
- assert_equal RESULT_CODE, obj.resultCode
48
- assert_equal RESULT_MESSAGE, obj.resultMessage
49
- assert_equal ACTION, obj.action
50
- assert_equal RESPONSE_CONTENT, obj.responseContent
51
- assert_equal CLIENT_AUTH_METHOD, obj.clientAuthMethod
52
- assert_equal REQUEST_URI, obj.requestUri
53
- end
54
-
55
-
56
- def test_from_json
57
- jsn = generate_json
58
- hsh = JSON.parse(jsn)
59
- actual = Authlete::Model::Response::PushedAuthReqResponse.new(hsh)
60
-
61
- match(actual)
62
- end
63
-
64
-
65
- def test_setters
66
- actual = Authlete::Model::Response::PushedAuthReqResponse.new
67
- actual.result_code = RESULT_CODE
68
- actual.result_message = RESULT_MESSAGE
69
- actual.action = ACTION
70
- actual.response_content = RESPONSE_CONTENT
71
- actual.client_auth_method = CLIENT_AUTH_METHOD
72
- actual.request_uri = REQUEST_URI
73
-
74
- match(actual)
75
- end
76
- 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 RevocationResponseTest < Minitest::Test
24
- RESULT_CODE = '<result-code>'
25
- RESULT_MESSAGE = '<result-message>'
26
- ACTION = 'OK'
27
- RESPONSE_CONTENT = '<response-content>'
28
-
29
-
30
- def generate_json
31
- return <<~JSON
32
- {
33
- "resultCode": "<result-code>",
34
- "resultMessage": "<result-message>",
35
- "action": "OK",
36
- "responseContent": "<response-content>"
37
- }
38
- JSON
39
- end
40
-
41
-
42
- def match(obj)
43
- assert_equal RESULT_CODE, obj.resultCode
44
- assert_equal RESULT_MESSAGE, obj.resultMessage
45
- assert_equal ACTION, obj.action
46
- assert_equal RESPONSE_CONTENT, obj.responseContent
47
- end
48
-
49
-
50
- def test_from_json
51
- jsn = generate_json
52
- hsh = JSON.parse(jsn)
53
- actual = Authlete::Model::Response::RevocationResponse.new(hsh)
54
-
55
- match(actual)
56
- end
57
-
58
-
59
- def test_setters
60
- actual = Authlete::Model::Response::RevocationResponse.new
61
- actual.result_code = RESULT_CODE
62
- actual.result_message = RESULT_MESSAGE
63
- actual.action = ACTION
64
- actual.response_content = RESPONSE_CONTENT
65
-
66
- match(actual)
67
- end
68
- end
@@ -1,72 +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 ServiceListResponseTest < Minitest::Test
24
- START_PARAM = 0
25
- END_PARAM = 2
26
- TOTAL_COUNT = 2
27
- SERVICE0_NAME = 'service0'
28
- SERVICE1_NAME = 'service1'
29
- SERVICES = [ Authlete::Model::Service.new(serviceName: SERVICE0_NAME),
30
- Authlete::Model::Service.new(serviceName: SERVICE1_NAME) ]
31
-
32
-
33
- def generate_json
34
- return <<~JSON
35
- {
36
- "start": 0,
37
- "end": 2,
38
- "totalCount": 2,
39
- "services": [ { "serviceName": "service0" }, { "serviceName": "service1" } ]
40
- }
41
- JSON
42
- end
43
-
44
-
45
- def match(obj)
46
- assert_equal START_PARAM, obj.start
47
- assert_equal END_PARAM, obj.end
48
- assert_equal TOTAL_COUNT, obj.totalCount
49
- assert_equal SERVICE0_NAME, obj.services[0].serviceName
50
- assert_equal SERVICE1_NAME, obj.services[1].serviceName
51
- end
52
-
53
-
54
- def test_from_json
55
- jsn = generate_json
56
- hsh = JSON.parse(jsn)
57
- actual = Authlete::Model::Response::ServiceListResponse.new(hsh)
58
-
59
- match(actual)
60
- end
61
-
62
-
63
- def test_setters
64
- actual = Authlete::Model::Response::ServiceListResponse.new
65
- actual.start = START_PARAM
66
- actual.end = END_PARAM
67
- actual.total_count = TOTAL_COUNT
68
- actual.services = SERVICES
69
-
70
- match(actual)
71
- end
72
- 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 StandardIntrospectionResponseTest < Minitest::Test
24
- RESULT_CODE = '<result-code>'
25
- RESULT_MESSAGE = '<result-message>'
26
- ACTION = 'OK'
27
- RESPONSE_CONTENT = '<response-content>'
28
-
29
-
30
- def generate_json
31
- return <<~JSON
32
- {
33
- "resultCode": "<result-code>",
34
- "resultMessage": "<result-message>",
35
- "action": "OK",
36
- "responseContent": "<response-content>"
37
- }
38
- JSON
39
- end
40
-
41
-
42
- def match(obj)
43
- assert_equal RESULT_CODE, obj.resultCode
44
- assert_equal RESULT_MESSAGE, obj.resultMessage
45
- assert_equal ACTION, obj.action
46
- assert_equal RESPONSE_CONTENT, obj.responseContent
47
- end
48
-
49
-
50
- def test_from_json
51
- jsn = generate_json
52
- hsh = JSON.parse(jsn)
53
- actual = Authlete::Model::Response::StandardIntrospectionResponse.new(hsh)
54
-
55
- match(actual)
56
- end
57
-
58
-
59
- def test_setters
60
- actual = Authlete::Model::Response::StandardIntrospectionResponse.new
61
- actual.result_code = RESULT_CODE
62
- actual.result_message = RESULT_MESSAGE
63
- actual.action = ACTION
64
- actual.response_content = RESPONSE_CONTENT
65
-
66
- match(actual)
67
- end
68
- end
@@ -1,107 +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 TokenCreateResponseTest < Minitest::Test
24
- RESULT_CODE = '<result-code>'
25
- RESULT_MESSAGE = '<result-message>'
26
- ACTION = 'OK'
27
- GRANT_TYPE = 'AUTHORIZATION_CODE'
28
- CLIENT_ID = 12345
29
- SUBJECT = '<subject>'
30
- SCOPES = [ 'scope0', 'scope1' ]
31
- ACCESS_TOKEN = '<access-token>'
32
- TOKEN_TYPE = 'Bearer'
33
- EXPIRES_IN = 1000
34
- EXPIRES_AT = 1000
35
- REFRESH_TOKEN = '<refresh-token>'
36
- PROPERTY_KEY = '<property0-key>'
37
- PROPERTY_VALUE = '<property0-value>'
38
- PROPERTIES = [ Authlete::Model::Property.new(key: PROPERTY_KEY, value: PROPERTY_VALUE) ]
39
-
40
-
41
- def generate_json
42
- return <<~JSON
43
- {
44
- "resultCode": "<result-code>",
45
- "resultMessage": "<result-message>",
46
- "action": "OK",
47
- "grantType": "AUTHORIZATION_CODE",
48
- "clientId": 12345,
49
- "subject": "<subject>",
50
- "scopes": [ "scope0", "scope1" ],
51
- "accessToken": "<access-token>",
52
- "tokenType": "Bearer",
53
- "expiresIn": 1000,
54
- "expiresAt": 1000,
55
- "refreshToken": "<refresh-token>",
56
- "properties": [ { "key": "<property0-key>", "value": "<property0-value>" } ]
57
- }
58
- JSON
59
- end
60
-
61
-
62
- def match(obj)
63
- assert_equal RESULT_CODE, obj.resultCode
64
- assert_equal RESULT_MESSAGE, obj.resultMessage
65
- assert_equal ACTION, obj.action
66
- assert_equal GRANT_TYPE, obj.grantType
67
- assert_equal CLIENT_ID, obj.clientId
68
- assert_equal SUBJECT, obj.subject
69
- assert_equal SCOPES, obj.scopes
70
- assert_equal ACCESS_TOKEN, obj.accessToken
71
- assert_equal TOKEN_TYPE, obj.tokenType
72
- assert_equal EXPIRES_IN, obj.expiresIn
73
- assert_equal EXPIRES_AT, obj.expiresAt
74
- assert_equal REFRESH_TOKEN, obj.refreshToken
75
- assert_equal PROPERTY_KEY, obj.properties[0].key
76
- assert_equal PROPERTY_VALUE, obj.properties[0].value
77
- end
78
-
79
-
80
- def test_from_json
81
- jsn = generate_json
82
- hsh = JSON.parse(jsn)
83
- actual = Authlete::Model::Response::TokenCreateResponse.new(hsh)
84
-
85
- match(actual)
86
- end
87
-
88
-
89
- def test_setters
90
- actual = Authlete::Model::Response::TokenCreateResponse.new
91
- actual.result_code = RESULT_CODE
92
- actual.result_message = RESULT_MESSAGE
93
- actual.action = ACTION
94
- actual.grant_type = GRANT_TYPE
95
- actual.client_id = CLIENT_ID
96
- actual.subject = SUBJECT
97
- actual.scopes = SCOPES
98
- actual.access_token = ACCESS_TOKEN
99
- actual.token_type = TOKEN_TYPE
100
- actual.expires_in = EXPIRES_IN
101
- actual.expires_at = EXPIRES_AT
102
- actual.refresh_token = REFRESH_TOKEN
103
- actual.properties = PROPERTIES
104
-
105
- match(actual)
106
- end
107
- 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 TokenFailResponseTest < Minitest::Test
24
- RESULT_CODE = '<result-code>'
25
- RESULT_MESSAGE = '<result-message>'
26
- ACTION = 'BAD_REQUEST'
27
- RESPONSE_CONTENT = '<response-content>'
28
-
29
-
30
- def generate_json
31
- return <<~JSON
32
- {
33
- "resultCode": "<result-code>",
34
- "resultMessage": "<result-message>",
35
- "action": "BAD_REQUEST",
36
- "responseContent": "<response-content>"
37
- }
38
- JSON
39
- end
40
-
41
-
42
- def match(obj)
43
- assert_equal RESULT_CODE, obj.resultCode
44
- assert_equal RESULT_MESSAGE, obj.resultMessage
45
- assert_equal ACTION, obj.action
46
- assert_equal RESPONSE_CONTENT, obj.responseContent
47
- end
48
-
49
-
50
- def test_from_json
51
- jsn = generate_json
52
- hsh = JSON.parse(jsn)
53
- actual = Authlete::Model::Response::TokenFailResponse.new(hsh)
54
-
55
- match(actual)
56
- end
57
-
58
-
59
- def test_setters
60
- actual = Authlete::Model::Response::TokenFailResponse.new
61
- actual.result_code = RESULT_CODE
62
- actual.result_message = RESULT_MESSAGE
63
- actual.action = ACTION
64
- actual.response_content = RESPONSE_CONTENT
65
-
66
- match(actual)
67
- end
68
- end