ory-kratos-client 0.0.3.alpha1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/README.md +128 -0
  4. data/Rakefile +10 -0
  5. data/docs/AdminApi.md +389 -0
  6. data/docs/CommonApi.md +152 -0
  7. data/docs/CompleteSelfServiceBrowserProfileManagementFlowPayload.md +17 -0
  8. data/docs/Error.md +17 -0
  9. data/docs/Form.md +23 -0
  10. data/docs/FormField.md +25 -0
  11. data/docs/GenericError.md +17 -0
  12. data/docs/GenericErrorPayload.md +29 -0
  13. data/docs/HealthApi.md +96 -0
  14. data/docs/HealthNotReadyStatus.md +17 -0
  15. data/docs/HealthStatus.md +17 -0
  16. data/docs/Identity.md +23 -0
  17. data/docs/LoginRequest.md +27 -0
  18. data/docs/LoginRequestMethod.md +19 -0
  19. data/docs/LoginRequestMethodConfig.md +16 -0
  20. data/docs/OidcStrategyCredentialsConfig.md +19 -0
  21. data/docs/OidcStrategyRequestMethod.md +25 -0
  22. data/docs/ProfileManagementRequest.md +29 -0
  23. data/docs/PublicApi.md +419 -0
  24. data/docs/RegistrationRequest.md +27 -0
  25. data/docs/RegistrationRequestMethod.md +19 -0
  26. data/docs/RegistrationRequestMethodConfig.md +16 -0
  27. data/docs/Session.md +25 -0
  28. data/docs/Version.md +17 -0
  29. data/docs/VersionApi.md +52 -0
  30. data/lib/ory-kratos-client.rb +62 -0
  31. data/lib/ory-kratos-client/api/admin_api.rb +525 -0
  32. data/lib/ory-kratos-client/api/common_api.rb +211 -0
  33. data/lib/ory-kratos-client/api/health_api.rb +134 -0
  34. data/lib/ory-kratos-client/api/public_api.rb +558 -0
  35. data/lib/ory-kratos-client/api/version_api.rb +78 -0
  36. data/lib/ory-kratos-client/api_client.rb +385 -0
  37. data/lib/ory-kratos-client/api_error.rb +57 -0
  38. data/lib/ory-kratos-client/configuration.rb +241 -0
  39. data/lib/ory-kratos-client/models/complete_self_service_browser_profile_management_flow_payload.rb +212 -0
  40. data/lib/ory-kratos-client/models/error.rb +207 -0
  41. data/lib/ory-kratos-client/models/form.rb +242 -0
  42. data/lib/ory-kratos-client/models/form_field.rb +250 -0
  43. data/lib/ory-kratos-client/models/generic_error.rb +207 -0
  44. data/lib/ory-kratos-client/models/generic_error_payload.rb +265 -0
  45. data/lib/ory-kratos-client/models/health_not_ready_status.rb +209 -0
  46. data/lib/ory-kratos-client/models/health_status.rb +207 -0
  47. data/lib/ory-kratos-client/models/identity.rb +245 -0
  48. data/lib/ory-kratos-client/models/login_request.rb +258 -0
  49. data/lib/ory-kratos-client/models/login_request_method.rb +216 -0
  50. data/lib/ory-kratos-client/models/login_request_method_config.rb +197 -0
  51. data/lib/ory-kratos-client/models/oidc_strategy_credentials_config.rb +215 -0
  52. data/lib/ory-kratos-client/models/oidc_strategy_request_method.rb +252 -0
  53. data/lib/ory-kratos-client/models/profile_management_request.rb +265 -0
  54. data/lib/ory-kratos-client/models/registration_request.rb +258 -0
  55. data/lib/ory-kratos-client/models/registration_request_method.rb +216 -0
  56. data/lib/ory-kratos-client/models/registration_request_method_config.rb +197 -0
  57. data/lib/ory-kratos-client/models/session.rb +242 -0
  58. data/lib/ory-kratos-client/models/version.rb +207 -0
  59. data/lib/ory-kratos-client/version.rb +15 -0
  60. data/ory-kratos-client.gemspec +39 -0
  61. data/spec/api/admin_api_spec.rb +131 -0
  62. data/spec/api/common_api_spec.rb +71 -0
  63. data/spec/api/health_api_spec.rb +57 -0
  64. data/spec/api/public_api_spec.rb +113 -0
  65. data/spec/api/version_api_spec.rb +46 -0
  66. data/spec/api_client_spec.rb +226 -0
  67. data/spec/configuration_spec.rb +42 -0
  68. data/spec/models/complete_self_service_browser_profile_management_flow_payload_spec.rb +41 -0
  69. data/spec/models/error_spec.rb +41 -0
  70. data/spec/models/form_field_spec.rb +65 -0
  71. data/spec/models/form_spec.rb +59 -0
  72. data/spec/models/generic_error_payload_spec.rb +77 -0
  73. data/spec/models/generic_error_spec.rb +59 -0
  74. data/spec/models/health_not_ready_status_spec.rb +41 -0
  75. data/spec/models/health_status_spec.rb +41 -0
  76. data/spec/models/identity_spec.rb +53 -0
  77. data/spec/models/login_request_method_config_spec.rb +35 -0
  78. data/spec/models/login_request_method_spec.rb +47 -0
  79. data/spec/models/login_request_spec.rb +71 -0
  80. data/spec/models/oidc_strategy_credentials_config_spec.rb +47 -0
  81. data/spec/models/oidc_strategy_request_method_spec.rb +65 -0
  82. data/spec/models/profile_management_request_spec.rb +77 -0
  83. data/spec/models/registration_request_method_config_spec.rb +35 -0
  84. data/spec/models/registration_request_method_spec.rb +47 -0
  85. data/spec/models/registration_request_spec.rb +71 -0
  86. data/spec/models/session_spec.rb +65 -0
  87. data/spec/models/version_spec.rb +41 -0
  88. data/spec/spec_helper.rb +111 -0
  89. metadata +219 -0
@@ -0,0 +1,57 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: v0.0.0-alpha.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for OryHydraClient::HealthApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'HealthApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = OryHydraClient::HealthApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of HealthApi' do
30
+ it 'should create an instance of HealthApi' do
31
+ expect(@api_instance).to be_instance_of(OryHydraClient::HealthApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for is_instance_alive
36
+ # Check alive status
37
+ # This endpoint returns a 200 status code when the HTTP server is up running. This status does currently not include checks whether the database connection is working. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [HealthStatus]
40
+ describe 'is_instance_alive test' do
41
+ it 'should work' do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ # unit tests for is_instance_ready
47
+ # Check readiness status
48
+ # This endpoint returns a 200 status code when the HTTP server is up running and the environment dependencies (e.g. the database) are responsive as well. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
49
+ # @param [Hash] opts the optional parameters
50
+ # @return [HealthStatus]
51
+ describe 'is_instance_ready test' do
52
+ it 'should work' do
53
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
54
+ end
55
+ end
56
+
57
+ end
@@ -0,0 +1,113 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: v0.0.0-alpha.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for OryHydraClient::PublicApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'PublicApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = OryHydraClient::PublicApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of PublicApi' do
30
+ it 'should create an instance of PublicApi' do
31
+ expect(@api_instance).to be_instance_of(OryHydraClient::PublicApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for complete_profile_management_flow
36
+ # Complete Profile Management Flow
37
+ # This endpoint returns a login request's context with, for example, error details and other information. For an in-depth look at ORY Krato's profile management flow, head over to: https://www.ory.sh/docs/kratos/selfservice/profile
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [nil]
40
+ describe 'complete_profile_management_flow test' do
41
+ it 'should work' do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ # unit tests for get_login_request
47
+ # Get Login Request
48
+ # This endpoint returns a login request's context with, for example, error details and other information. For an in-depth look at ORY Krato's login flow, head over to: https://www.ory.sh/docs/kratos/selfservice/login
49
+ # @param [Hash] opts the optional parameters
50
+ # @return [LoginRequest]
51
+ describe 'get_login_request test' do
52
+ it 'should work' do
53
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
54
+ end
55
+ end
56
+
57
+ # unit tests for get_profile_management_request
58
+ # Get Profile Management Request (via cookie)
59
+ # This endpoint returns a profile management request's context with, for example, error details and other information. It can be used from a Single Page Application or other applications running on a client device. The request must be made with valid authentication cookies or it will fail! If you wish to access this endpoint without the valid cookies (e.g. as part of a server) please call this path at the admin port. For an in-depth look at ORY Krato's profile management flow, head over to: https://www.ory.sh/docs/kratos/selfservice/profile
60
+ # @param request Request should be set to the value of the `request` query parameter by the profile management UI.
61
+ # @param [Hash] opts the optional parameters
62
+ # @return [ProfileManagementRequest]
63
+ describe 'get_profile_management_request test' do
64
+ it 'should work' do
65
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
66
+ end
67
+ end
68
+
69
+ # unit tests for get_registration_request
70
+ # Get Registration Request
71
+ # This endpoint returns a registration request's context with, for example, error details and other information. For an in-depth look at ORY Krato's registration flow, head over to: https://www.ory.sh/docs/kratos/selfservice/registration
72
+ # @param [Hash] opts the optional parameters
73
+ # @return [RegistrationRequest]
74
+ describe 'get_registration_request test' do
75
+ it 'should work' do
76
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
77
+ end
78
+ end
79
+
80
+ # unit tests for initialize_login_flow
81
+ # Initialize a Login Flow
82
+ # This endpoint initializes a login flow. This endpoint **should not be called from a programatic API** but instead for the, for example, browser. It will redirect the user agent (e.g. browser) to the configured login UI, appending the login challenge. If the user-agent already has a valid authentication session, the server will respond with a 302 code redirecting to the config value of `urls.default_return_to`. For an in-depth look at ORY Krato's login flow, head over to: https://www.ory.sh/docs/kratos/selfservice/login
83
+ # @param [Hash] opts the optional parameters
84
+ # @return [nil]
85
+ describe 'initialize_login_flow test' do
86
+ it 'should work' do
87
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
88
+ end
89
+ end
90
+
91
+ # unit tests for initialize_profile_management_flow
92
+ # Initialize Profile Management Flow
93
+ # This endpoint initializes a profile update flow. This endpoint **should not be called from a programatic API** but instead for the, for example, browser. It will redirect the user agent (e.g. browser) to the configured login UI, appending the login challenge. If the user-agent does not have a valid authentication session, a 302 code will be returned which redirects to the initializeLoginFlow endpoint, appending this page as the return_to value. For an in-depth look at ORY Krato's profile management flow, head over to: https://www.ory.sh/docs/kratos/selfservice/profile
94
+ # @param [Hash] opts the optional parameters
95
+ # @return [nil]
96
+ describe 'initialize_profile_management_flow test' do
97
+ it 'should work' do
98
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
99
+ end
100
+ end
101
+
102
+ # unit tests for initialize_registration_flow
103
+ # Initialize a Registration Flow
104
+ # This endpoint initializes a registration flow. This endpoint **should not be called from a programatic API** but instead for the, for example, browser. It will redirect the user agent (e.g. browser) to the configured registration UI, appending the registration challenge. For an in-depth look at ORY Krato's registration flow, head over to: https://www.ory.sh/docs/kratos/selfservice/registration
105
+ # @param [Hash] opts the optional parameters
106
+ # @return [nil]
107
+ describe 'initialize_registration_flow test' do
108
+ it 'should work' do
109
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
110
+ end
111
+ end
112
+
113
+ end
@@ -0,0 +1,46 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: v0.0.0-alpha.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+ require 'json'
15
+
16
+ # Unit tests for OryHydraClient::VersionApi
17
+ # Automatically generated by openapi-generator (https://openapi-generator.tech)
18
+ # Please update as you see appropriate
19
+ describe 'VersionApi' do
20
+ before do
21
+ # run before each test
22
+ @api_instance = OryHydraClient::VersionApi.new
23
+ end
24
+
25
+ after do
26
+ # run after each test
27
+ end
28
+
29
+ describe 'test an instance of VersionApi' do
30
+ it 'should create an instance of VersionApi' do
31
+ expect(@api_instance).to be_instance_of(OryHydraClient::VersionApi)
32
+ end
33
+ end
34
+
35
+ # unit tests for get_version
36
+ # Get service version
37
+ # This endpoint returns the service version typically notated using semantic versioning. If the service supports TLS Edge Termination, this endpoint does not require the `X-Forwarded-Proto` header to be set. Be aware that if you are running multiple nodes of this service, the health status will never refer to the cluster state, only to a single instance.
38
+ # @param [Hash] opts the optional parameters
39
+ # @return [Version]
40
+ describe 'get_version test' do
41
+ it 'should work' do
42
+ # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
43
+ end
44
+ end
45
+
46
+ end
@@ -0,0 +1,226 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: v0.0.0-alpha.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+
15
+ describe OryHydraClient::ApiClient do
16
+ context 'initialization' do
17
+ context 'URL stuff' do
18
+ context 'host' do
19
+ it 'removes http from host' do
20
+ OryHydraClient.configure { |c| c.host = 'http://example.com' }
21
+ expect(OryHydraClient::Configuration.default.host).to eq('example.com')
22
+ end
23
+
24
+ it 'removes https from host' do
25
+ OryHydraClient.configure { |c| c.host = 'https://wookiee.com' }
26
+ expect(OryHydraClient::ApiClient.default.config.host).to eq('wookiee.com')
27
+ end
28
+
29
+ it 'removes trailing path from host' do
30
+ OryHydraClient.configure { |c| c.host = 'hobo.com/v4' }
31
+ expect(OryHydraClient::Configuration.default.host).to eq('hobo.com')
32
+ end
33
+ end
34
+
35
+ context 'base_path' do
36
+ it "prepends a slash to base_path" do
37
+ OryHydraClient.configure { |c| c.base_path = 'v4/dog' }
38
+ expect(OryHydraClient::Configuration.default.base_path).to eq('/v4/dog')
39
+ end
40
+
41
+ it "doesn't prepend a slash if one is already there" do
42
+ OryHydraClient.configure { |c| c.base_path = '/v4/dog' }
43
+ expect(OryHydraClient::Configuration.default.base_path).to eq('/v4/dog')
44
+ end
45
+
46
+ it "ends up as a blank string if nil" do
47
+ OryHydraClient.configure { |c| c.base_path = nil }
48
+ expect(OryHydraClient::Configuration.default.base_path).to eq('')
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ describe 'params_encoding in #build_request' do
55
+ let(:config) { OryHydraClient::Configuration.new }
56
+ let(:api_client) { OryHydraClient::ApiClient.new(config) }
57
+
58
+ it 'defaults to nil' do
59
+ expect(OryHydraClient::Configuration.default.params_encoding).to eq(nil)
60
+ expect(config.params_encoding).to eq(nil)
61
+
62
+ request = api_client.build_request(:get, '/test')
63
+ expect(request.options[:params_encoding]).to eq(nil)
64
+ end
65
+
66
+ it 'can be customized' do
67
+ config.params_encoding = :multi
68
+ request = api_client.build_request(:get, '/test')
69
+ expect(request.options[:params_encoding]).to eq(:multi)
70
+ end
71
+ end
72
+
73
+ describe 'timeout in #build_request' do
74
+ let(:config) { OryHydraClient::Configuration.new }
75
+ let(:api_client) { OryHydraClient::ApiClient.new(config) }
76
+
77
+ it 'defaults to 0' do
78
+ expect(OryHydraClient::Configuration.default.timeout).to eq(0)
79
+ expect(config.timeout).to eq(0)
80
+
81
+ request = api_client.build_request(:get, '/test')
82
+ expect(request.options[:timeout]).to eq(0)
83
+ end
84
+
85
+ it 'can be customized' do
86
+ config.timeout = 100
87
+ request = api_client.build_request(:get, '/test')
88
+ expect(request.options[:timeout]).to eq(100)
89
+ end
90
+ end
91
+
92
+ describe '#deserialize' do
93
+ it "handles Array<Integer>" do
94
+ api_client = OryHydraClient::ApiClient.new
95
+ headers = { 'Content-Type' => 'application/json' }
96
+ response = double('response', headers: headers, body: '[12, 34]')
97
+ data = api_client.deserialize(response, 'Array<Integer>')
98
+ expect(data).to be_instance_of(Array)
99
+ expect(data).to eq([12, 34])
100
+ end
101
+
102
+ it 'handles Array<Array<Integer>>' do
103
+ api_client = OryHydraClient::ApiClient.new
104
+ headers = { 'Content-Type' => 'application/json' }
105
+ response = double('response', headers: headers, body: '[[12, 34], [56]]')
106
+ data = api_client.deserialize(response, 'Array<Array<Integer>>')
107
+ expect(data).to be_instance_of(Array)
108
+ expect(data).to eq([[12, 34], [56]])
109
+ end
110
+
111
+ it 'handles Hash<String, String>' do
112
+ api_client = OryHydraClient::ApiClient.new
113
+ headers = { 'Content-Type' => 'application/json' }
114
+ response = double('response', headers: headers, body: '{"message": "Hello"}')
115
+ data = api_client.deserialize(response, 'Hash<String, String>')
116
+ expect(data).to be_instance_of(Hash)
117
+ expect(data).to eq(:message => 'Hello')
118
+ end
119
+ end
120
+
121
+ describe "#object_to_hash" do
122
+ it 'ignores nils and includes empty arrays' do
123
+ # uncomment below to test object_to_hash for model
124
+ # api_client = OryHydraClient::ApiClient.new
125
+ # _model = OryHydraClient::ModelName.new
126
+ # update the model attribute below
127
+ # _model.id = 1
128
+ # update the expected value (hash) below
129
+ # expected = {id: 1, name: '', tags: []}
130
+ # expect(api_client.object_to_hash(_model)).to eq(expected)
131
+ end
132
+ end
133
+
134
+ describe '#build_collection_param' do
135
+ let(:param) { ['aa', 'bb', 'cc'] }
136
+ let(:api_client) { OryHydraClient::ApiClient.new }
137
+
138
+ it 'works for csv' do
139
+ expect(api_client.build_collection_param(param, :csv)).to eq('aa,bb,cc')
140
+ end
141
+
142
+ it 'works for ssv' do
143
+ expect(api_client.build_collection_param(param, :ssv)).to eq('aa bb cc')
144
+ end
145
+
146
+ it 'works for tsv' do
147
+ expect(api_client.build_collection_param(param, :tsv)).to eq("aa\tbb\tcc")
148
+ end
149
+
150
+ it 'works for pipes' do
151
+ expect(api_client.build_collection_param(param, :pipes)).to eq('aa|bb|cc')
152
+ end
153
+
154
+ it 'works for multi' do
155
+ expect(api_client.build_collection_param(param, :multi)).to eq(['aa', 'bb', 'cc'])
156
+ end
157
+
158
+ it 'fails for invalid collection format' do
159
+ expect{api_client.build_collection_param(param, :INVALID)}.to raise_error(RuntimeError, 'unknown collection format: :INVALID')
160
+ end
161
+ end
162
+
163
+ describe '#json_mime?' do
164
+ let(:api_client) { OryHydraClient::ApiClient.new }
165
+
166
+ it 'works' do
167
+ expect(api_client.json_mime?(nil)).to eq false
168
+ expect(api_client.json_mime?('')).to eq false
169
+
170
+ expect(api_client.json_mime?('application/json')).to eq true
171
+ expect(api_client.json_mime?('application/json; charset=UTF8')).to eq true
172
+ expect(api_client.json_mime?('APPLICATION/JSON')).to eq true
173
+
174
+ expect(api_client.json_mime?('application/xml')).to eq false
175
+ expect(api_client.json_mime?('text/plain')).to eq false
176
+ expect(api_client.json_mime?('application/jsonp')).to eq false
177
+ end
178
+ end
179
+
180
+ describe '#select_header_accept' do
181
+ let(:api_client) { OryHydraClient::ApiClient.new }
182
+
183
+ it 'works' do
184
+ expect(api_client.select_header_accept(nil)).to be_nil
185
+ expect(api_client.select_header_accept([])).to be_nil
186
+
187
+ expect(api_client.select_header_accept(['application/json'])).to eq('application/json')
188
+ expect(api_client.select_header_accept(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
189
+ expect(api_client.select_header_accept(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
190
+
191
+ expect(api_client.select_header_accept(['application/xml'])).to eq('application/xml')
192
+ expect(api_client.select_header_accept(['text/html', 'application/xml'])).to eq('text/html,application/xml')
193
+ end
194
+ end
195
+
196
+ describe '#select_header_content_type' do
197
+ let(:api_client) { OryHydraClient::ApiClient.new }
198
+
199
+ it 'works' do
200
+ expect(api_client.select_header_content_type(nil)).to eq('application/json')
201
+ expect(api_client.select_header_content_type([])).to eq('application/json')
202
+
203
+ expect(api_client.select_header_content_type(['application/json'])).to eq('application/json')
204
+ expect(api_client.select_header_content_type(['application/xml', 'application/json; charset=UTF8'])).to eq('application/json; charset=UTF8')
205
+ expect(api_client.select_header_content_type(['APPLICATION/JSON', 'text/html'])).to eq('APPLICATION/JSON')
206
+ expect(api_client.select_header_content_type(['application/xml'])).to eq('application/xml')
207
+ expect(api_client.select_header_content_type(['text/plain', 'application/xml'])).to eq('text/plain')
208
+ end
209
+ end
210
+
211
+ describe '#sanitize_filename' do
212
+ let(:api_client) { OryHydraClient::ApiClient.new }
213
+
214
+ it 'works' do
215
+ expect(api_client.sanitize_filename('sun')).to eq('sun')
216
+ expect(api_client.sanitize_filename('sun.gif')).to eq('sun.gif')
217
+ expect(api_client.sanitize_filename('../sun.gif')).to eq('sun.gif')
218
+ expect(api_client.sanitize_filename('/var/tmp/sun.gif')).to eq('sun.gif')
219
+ expect(api_client.sanitize_filename('./sun.gif')).to eq('sun.gif')
220
+ expect(api_client.sanitize_filename('..\sun.gif')).to eq('sun.gif')
221
+ expect(api_client.sanitize_filename('\var\tmp\sun.gif')).to eq('sun.gif')
222
+ expect(api_client.sanitize_filename('c:\var\tmp\sun.gif')).to eq('sun.gif')
223
+ expect(api_client.sanitize_filename('.\sun.gif')).to eq('sun.gif')
224
+ end
225
+ end
226
+ end
@@ -0,0 +1,42 @@
1
+ =begin
2
+ #Ory Kratos
3
+
4
+ #Welcome to the ORY Kratos HTTP API documentation!
5
+
6
+ The version of the OpenAPI document: v0.0.0-alpha.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.2
10
+
11
+ =end
12
+
13
+ require 'spec_helper'
14
+
15
+ describe OryHydraClient::Configuration do
16
+ let(:config) { OryHydraClient::Configuration.default }
17
+
18
+ before(:each) do
19
+ # uncomment below to setup host and base_path
20
+ # require 'URI'
21
+ # uri = URI.parse("http://localhost")
22
+ # OryHydraClient.configure do |c|
23
+ # c.host = uri.host
24
+ # c.base_path = uri.path
25
+ # end
26
+ end
27
+
28
+ describe '#base_url' do
29
+ it 'should have the default value' do
30
+ # uncomment below to test default value of the base path
31
+ # expect(config.base_url).to eq("http://localhost")
32
+ end
33
+
34
+ it 'should remove trailing slashes' do
35
+ [nil, '', '/', '//'].each do |base_path|
36
+ config.base_path = base_path
37
+ # uncomment below to test trailing slashes
38
+ # expect(config.base_url).to eq("http://localhost")
39
+ end
40
+ end
41
+ end
42
+ end