clx_api 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +13 -0
  3. data/.yardopts +1 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +55 -0
  7. data/Rakefile +7 -0
  8. data/clx_api.gemspec +26 -0
  9. data/doc/CLX.html +305 -0
  10. data/doc/CLX/API.html +1491 -0
  11. data/doc/CLX/CLXAPIException.html +411 -0
  12. data/doc/CLX/CLXException.html +134 -0
  13. data/doc/CLX/HTTPAdapter.html +1294 -0
  14. data/doc/CLX/HTTPClient.html +1058 -0
  15. data/doc/ClxApi.html +141 -0
  16. data/doc/_index.html +161 -0
  17. data/doc/class_list.html +58 -0
  18. data/doc/css/common.css +1 -0
  19. data/doc/css/full_list.css +57 -0
  20. data/doc/css/style.css +339 -0
  21. data/doc/file.README.html +112 -0
  22. data/doc/file_list.html +60 -0
  23. data/doc/frames.html +26 -0
  24. data/doc/index.html +112 -0
  25. data/doc/js/app.js +219 -0
  26. data/doc/js/full_list.js +181 -0
  27. data/doc/js/jquery.js +4 -0
  28. data/doc/method_list.html +279 -0
  29. data/doc/top-level-namespace.html +112 -0
  30. data/examples/get_gateway_by_id.rb +16 -0
  31. data/examples/get_gateways.rb +18 -0
  32. data/examples/get_operator_by_id.rb +21 -0
  33. data/examples/get_operators.rb +23 -0
  34. data/examples/get_price_entries_by_gateway_id.rb +19 -0
  35. data/examples/get_price_entries_by_gateway_id_and_operator_id.rb +17 -0
  36. data/examples/get_price_entries_by_gateway_id_and_operator_id_and_date.rb +18 -0
  37. data/examples/readme.md +167 -0
  38. data/lib/clx_api.rb +35 -0
  39. data/lib/clx_api/api.rb +132 -0
  40. data/lib/clx_api/exceptions/clx_api_exception.rb +25 -0
  41. data/lib/clx_api/exceptions/clx_exception.rb +8 -0
  42. data/lib/clx_api/http_adapter.rb +129 -0
  43. data/lib/clx_api/http_client.rb +163 -0
  44. data/lib/clx_api/version.rb +4 -0
  45. data/test/adapter/test_adapter.rb +67 -0
  46. data/test/api_test.rb +306 -0
  47. data/test/http_adapter_test.rb +211 -0
  48. data/test/http_client_test.rb +173 -0
  49. data/test/test_helper.rb +7 -0
  50. metadata +168 -0
@@ -0,0 +1,4 @@
1
+ module CLX
2
+ # Version
3
+ VERSION = '0.1.0'
4
+ end
@@ -0,0 +1,67 @@
1
+ require 'uri'
2
+ require 'json'
3
+
4
+ module CLX
5
+
6
+ #HTTP Adapter class for making RESTful HTTP-requests
7
+ class TestAdapter
8
+
9
+ # @!attribute [r]
10
+ attr_accessor :response
11
+
12
+ # @!attribute [r]
13
+ attr_accessor :request_url
14
+
15
+ # @!attribute [r]
16
+ attr_accessor :request_method
17
+
18
+ # @!attribute [r]
19
+ attr_reader :username
20
+
21
+ # @!attribute [r]
22
+ attr_reader :password
23
+
24
+ # Set credentials for basic auth
25
+ def set_auth(username, password)
26
+ raise CLXException, 'Username must be a string' unless username.is_a? String
27
+ raise CLXException, 'Password must be a string' unless password.is_a? String
28
+ raise CLXException, 'Username can not be an empty string' unless username.length > 0
29
+ raise CLXException, 'Password can not be an empty string' unless password.length > 0
30
+
31
+ @username = username
32
+ @password = password
33
+ end
34
+
35
+ # GET-request
36
+ def get(uri)
37
+ return execute('get', uri)
38
+ end
39
+
40
+ # POST-request
41
+ def post(uri, data)
42
+ return execute('post', uri, data)
43
+ end
44
+
45
+ # PUT-request
46
+ def put(uri, data)
47
+ return execute('put', uri, data)
48
+ end
49
+
50
+ # DELETE-request
51
+ def delete(uri)
52
+ return execute('delete', uri)
53
+ end
54
+
55
+ private
56
+
57
+ # Execute request
58
+ def execute(method, uri, data = nil)
59
+
60
+ @request_url = uri.to_s
61
+ @request_method = method.upcase
62
+ return @response
63
+ end
64
+
65
+ end
66
+
67
+ end
data/test/api_test.rb ADDED
@@ -0,0 +1,306 @@
1
+ require 'test_helper'
2
+
3
+ class APITest < MiniTest::Test
4
+
5
+ def setup
6
+ http_adapter = CLX::TestAdapter.new
7
+ @api = CLX::API.new 'username', 'password', http_adapter
8
+ end
9
+
10
+ # Initializer
11
+ def test_that_object_is_of_correct_instance
12
+ assert_instance_of CLX::API, @api
13
+ end
14
+
15
+ def test_initializer_without_arguments_raises_error
16
+ assert_raises ArgumentError do
17
+ CLX::API.new
18
+ end
19
+ end
20
+
21
+ def test_initializer_with_too_few_arguments_raises_error
22
+ assert_raises ArgumentError do
23
+ CLX::API.new 'username'
24
+ end
25
+ end
26
+
27
+ def test_initializer_with_too_many_arguments_raises_error
28
+ assert_raises ArgumentError do
29
+ CLX::API.new 'username', 'password', nil, 'one_argument_too_much'
30
+ end
31
+ end
32
+
33
+ def test_initializer_argument_username_not_string_raises_CLX_exception
34
+ assert_raises CLX::CLXException do
35
+ CLX::API.new 1, 'a_password'
36
+ end
37
+
38
+ assert_raises CLX::CLXException do
39
+ @user = {username: 'a_username'}
40
+ CLX::API.new @user, 'a_password'
41
+ end
42
+
43
+ assert_raises CLX::CLXException do
44
+ CLX::API.new nil, 'a_password'
45
+ end
46
+ end
47
+
48
+ def test_initializer_argument_password_not_string_raises_CLX_exception
49
+ assert_raises CLX::CLXException do
50
+ CLX::API.new 'a_username', 1
51
+ end
52
+
53
+ assert_raises CLX::CLXException do
54
+ @password = {password: 'a_password'}
55
+ CLX::API.new 'a_username', @password
56
+ end
57
+
58
+ assert_raises CLX::CLXException do
59
+ CLX::API.new 'a_username', nil
60
+ end
61
+ end
62
+
63
+ #Public setter methods
64
+ def test_setting_auth_credentials_works
65
+ adapter = @api.http_client.http_adapter
66
+ @api.set_auth('new_username', 'new_password')
67
+ assert_equal adapter.username, 'new_username'
68
+ assert_equal adapter.password, 'new_password'
69
+ end
70
+
71
+ def test_setting_base_url_works
72
+ client = @api.http_client
73
+ @api.set_base_url('http://new.url')
74
+ assert_equal client.base_url, 'http://new.url'
75
+ end
76
+
77
+ def test_request_with_invalid_username_and_password_raises_CLX_exception
78
+ @api.set_auth('wrong_username', 'wrong_password')
79
+ response = OpenStruct.new(
80
+ body: '{}',
81
+ code: 401
82
+ )
83
+ @api.http_client.http_adapter.response = response
84
+
85
+ assert_raises CLX::CLXAPIException do
86
+ result = @api.get_operators
87
+ end
88
+ end
89
+
90
+ #Operator tests
91
+ def test_get_operators_returns_list_of_operators
92
+ response = OpenStruct.new(
93
+ body: '[
94
+ {"id":1,"name":"Foo","network":"Foonetwork","uniqueName":"Foo uniquq","isoCountryCode":"8","operationalState":"active","operationalStatDate":"-0001-11-30 00:00:00","numberOfSubscribers":0},
95
+ {"id":1058,"name":"Bar mobile","network":"Bar Mobile","uniqueName":"Foo Mobile-unique","isoCountryCode":"8","operationalState":"active","operationalStatDate":"-0001-11-30 00:00:00","numberOfSubscribers":0}
96
+ ]',
97
+ code: 200
98
+ )
99
+ @api.http_client.http_adapter.response = response
100
+
101
+ result = @api.get_operators
102
+
103
+ refute_nil result
104
+ refute_empty result
105
+ assert_equal(result.size, 2)
106
+ end
107
+
108
+ def test_get_operator_by_id_returns_single_operator
109
+ response = OpenStruct.new(
110
+ body: '{"id":1,"name":"Foo","network":"Foonetwork","uniqueName":"Foo uniquq","isoCountryCode":"8","operationalState":"active","operationalStatDate":"-0001-11-30 00:00:00","numberOfSubscribers":0}',
111
+ code: 200
112
+ )
113
+ @api.http_client.http_adapter.response = response
114
+
115
+ operator = @api.get_operator_by_id(1)
116
+
117
+ assert_equal operator.id, 1
118
+ end
119
+
120
+ def test_get_operator_by_id_with_non_existing_id_raises_CLX_exception_with_status_code_404
121
+ response = OpenStruct.new(
122
+ body: '{"error":{"message": "No operator with id: 9999", "code": 3001}}',
123
+ code: 404
124
+ )
125
+ @api.http_client.http_adapter.response = response
126
+
127
+ err = assert_raises CLX::CLXAPIException do
128
+ operator = @api.get_operator_by_id(9999)
129
+ end
130
+ end
131
+
132
+ def test_get_operator_by_id_with_non_integer_parameter_raises_CLX_exception
133
+ assert_raises CLX::CLXException do
134
+ operator = @api.get_operator_by_id('asd')
135
+ end
136
+ end
137
+
138
+ def test_get_operator_by_id_with_invalid_username_and_password_raises_CLX_exception
139
+ @api.set_auth('wrong_username', 'wrong_password')
140
+ response = OpenStruct.new(
141
+ body: '{}',
142
+ code: 401
143
+ )
144
+ @api.http_client.http_adapter.response = response
145
+ assert_raises CLX::CLXAPIException do
146
+ result = @api.get_operator_by_id(1)
147
+ end
148
+ end
149
+
150
+ #Gateway tests
151
+ def test_that_get_gateways_return_a_collection_of_gateways
152
+ response = OpenStruct.new(
153
+ body: '[
154
+ {"id":1,"name":"gateway no 1","type":"Some type 1"},
155
+ {"id":2,"name":"gateway no 2","type":"Some type 2"}
156
+ ]',
157
+ code: 200
158
+ )
159
+ @api.http_client.http_adapter.response = response
160
+
161
+ result = @api.get_gateways
162
+
163
+ refute_nil result
164
+ refute_empty result
165
+ assert_equal(result.size, 2)
166
+ end
167
+
168
+ def test_that_get_gateway_by_id_returns_single_gateway
169
+ response = OpenStruct.new(
170
+ body: '{"id":1,"name":"gateway no 1","type":"Some type 1"}',
171
+ code: 200
172
+ )
173
+ @api.http_client.http_adapter.response = response
174
+
175
+ gateway = @api.get_gateway_by_id(1)
176
+
177
+ assert_equal gateway.id, 1
178
+ end
179
+
180
+ def test_that_get_gateway_by_by_with_id_that_does_not_exist_raises_clx_api_exception
181
+ response = OpenStruct.new(
182
+ body: '{"error":{"message": "No gateway with id: 9999"}}',
183
+ code: 404
184
+ )
185
+ @api.http_client.http_adapter.response = response
186
+
187
+ assert_raises CLX::CLXAPIException do
188
+ gateway = @api.get_gateway_by_id(9999)
189
+ end
190
+ end
191
+
192
+ def test_that_get_gateway_by_id_with_non_integer_id_raises_clx_exception
193
+ assert_raises CLX::CLXException do
194
+ gateway = @api.get_gateway_by_id('a string')
195
+ end
196
+ end
197
+
198
+ def test_that_get_price_entires_by_gateway_id_return_collection_of_price_entires
199
+ response = OpenStruct.new(
200
+ body: '[
201
+ {"price": 0.25,"gateway":"gateway no 1","operator":"Some operator 1"},
202
+ {"price": 0.35,"gateway":"gateway no 1","operator":"Some operator 2"}
203
+ ]',
204
+ code: 200
205
+ )
206
+ @api.http_client.http_adapter.response = response
207
+
208
+ result = @api.get_price_entires_by_gateway_id(1)
209
+
210
+ refute_nil result
211
+ refute_empty result
212
+ assert_equal(result.size, 2)
213
+ end
214
+
215
+ def test_that_get_price_entires_by_gateway_id_with_id_that_does_not_exist_raises_clx_api_exception
216
+ response = OpenStruct.new(
217
+ body: '{"error":{"message": "No gateway with id: 9999"}}',
218
+ code: 404
219
+ )
220
+ @api.http_client.http_adapter.response = response
221
+
222
+ assert_raises CLX::CLXAPIException do
223
+ result = @api.get_price_entires_by_gateway_id(9999)
224
+ end
225
+ end
226
+
227
+ def test_that_get_price_entries_by_gateway_id_with_non_integer_id_raises_clx_exception
228
+ assert_raises CLX::CLXException do
229
+ gateway = @api.get_price_entires_by_gateway_id('a string')
230
+ end
231
+ end
232
+
233
+ def test_that_get_price_entry_by_gateway_id_and_operator_id_returns_price_entry
234
+ response = OpenStruct.new(
235
+ body: '{"price": "0.25","gateway": "gateway_1","operator": "Some operator","expireDate": 0}',
236
+ code: 200
237
+ )
238
+ @api.http_client.http_adapter.response = response
239
+
240
+ gateway = @api.get_price_entries_by_gateway_id_and_operator_id(1, 1)
241
+
242
+ assert_equal gateway.gateway, "gateway_1"
243
+ end
244
+
245
+ def test_that_get_price_entries_by_gateway_id_and_operator_id_with_non_integer_ids_raises_clx_exception
246
+ assert_raises CLX::CLXException do
247
+ gateway = @api.get_price_entries_by_gateway_id_and_operator_id('a string', 1)
248
+ end
249
+ assert_raises CLX::CLXException do
250
+ gateway = @api.get_price_entries_by_gateway_id_and_operator_id(1, 'a string')
251
+ end
252
+ assert_raises CLX::CLXException do
253
+ gateway = @api.get_price_entries_by_gateway_id_and_operator_id('a string', 'a string')
254
+ end
255
+ end
256
+
257
+ def test_that_get_price_entry_by_gateway_id_and_operator_id_and_date_returns_price_entry
258
+ response = OpenStruct.new(
259
+ body: '{"price": "0.25","gateway": "gateway_1","operator": "Some operator","expireDate": 0}',
260
+ code: 200
261
+ )
262
+ @api.http_client.http_adapter.response = response
263
+
264
+ gateway = @api.get_price_entries_by_gateway_id_and_operator_id_and_date(1, 1, DateTime.now)
265
+
266
+ assert_equal gateway.gateway, "gateway_1"
267
+ end
268
+
269
+ def test_that_get_price_entry_by_gateway_id_and_operator_id_and_date_with_ids_that_does_not_exist_raises_clx_api_exception
270
+ response = OpenStruct.new(
271
+ body: '{"error":{"message": "No gateway with id: 9999"}}',
272
+ code: 404
273
+ )
274
+ @api.http_client.http_adapter.response = response
275
+
276
+ assert_raises CLX::CLXAPIException do
277
+ result = @api.get_price_entries_by_gateway_id_and_operator_id_and_date(9999, 1, DateTime.now)
278
+ end
279
+
280
+ response = OpenStruct.new(
281
+ body: '{"error":{"message": "Trying to get current and next price: PriceLinkedList missing for operator with id: 9999 in pirce list with id: 1", "code": 1002}}',
282
+ code: 404
283
+ )
284
+ @api.http_client.http_adapter.response = response
285
+
286
+ assert_raises CLX::CLXAPIException do
287
+ result = @api.get_price_entries_by_gateway_id_and_operator_id_and_date(1, 9999, DateTime.now)
288
+ end
289
+ end
290
+
291
+ def test_that_get_price_entry_by_gateway_id_and_operator_id_and_date_with_invalid_parameters_raises_clx_exception
292
+ assert_raises CLX::CLXException do
293
+ gateway = @api.get_price_entries_by_gateway_id_and_operator_id_and_date('a string', 1, DateTime.now)
294
+ end
295
+ assert_raises CLX::CLXException do
296
+ gateway = @api.get_price_entries_by_gateway_id_and_operator_id_and_date(1, 'a string', DateTime.now)
297
+ end
298
+ assert_raises CLX::CLXException do
299
+ gateway = @api.get_price_entries_by_gateway_id_and_operator_id_and_date('a string', 'a string', DateTime.now)
300
+ end
301
+ assert_raises CLX::CLXException do
302
+ gateway = @api.get_price_entries_by_gateway_id_and_operator_id_and_date(1, 1, 'should_be_datetime')
303
+ end
304
+ end
305
+
306
+ end
@@ -0,0 +1,211 @@
1
+ require 'test_helper'
2
+
3
+ class HTTPAdapterTest < MiniTest::Test
4
+
5
+ def setup
6
+ @https_url = 'https://httpbin.org'
7
+ @http_url = 'http://httpbin.org'
8
+ @http_adapter = CLX::HTTPAdapter.new
9
+ end
10
+
11
+ def test_initializer
12
+ assert_instance_of CLX::HTTPAdapter, @http_adapter
13
+ end
14
+
15
+ def test_set_auth_method_set_username_and_password
16
+ @http_adapter.set_auth('new_username', 'new_password')
17
+ assert_equal @http_adapter.username, 'new_username'
18
+ assert_equal @http_adapter.password, 'new_password'
19
+ end
20
+
21
+ def test_set_auth_only_accepts_non_empty_strings
22
+ assert_raises CLX::CLXException do
23
+ @http_adapter.set_auth(1, 1)
24
+ end
25
+ assert_raises CLX::CLXException do
26
+ @http_adapter.set_auth('', '')
27
+ end
28
+ assert_raises CLX::CLXException do
29
+ @http_adapter.set_auth({username: 'username'}, password: 'password')
30
+ end
31
+ end
32
+
33
+ def test_basic_auth_via_https_get_returns_http_ok
34
+ @http_adapter.set_auth('user', 'pass')
35
+ uri = URI(@https_url + '/basic-auth/user/pass')
36
+ response = @http_adapter.get(uri)
37
+ assert_instance_of Net::HTTPOK, response
38
+ end
39
+
40
+ def test_basic_auth_via_http_get_returns_http_ok
41
+ @http_adapter.set_auth('user', 'pass')
42
+ uri = URI(@http_url + '/basic-auth/user/pass')
43
+ response = @http_adapter.get(uri)
44
+ assert_instance_of Net::HTTPOK, response
45
+ end
46
+
47
+ def test_basic_auth_with_incorrect_credentials_via_https_returns_http_unauthorized
48
+ @http_adapter.set_auth('wrong_username', 'wrong_password')
49
+ uri = URI(@https_url + '/basic-auth/user/passwd')
50
+ response = @http_adapter.get(uri)
51
+ assert_instance_of Net::HTTPUnauthorized, response
52
+ end
53
+
54
+ def test_basic_auth_with_incorrect_credentials_via_http_returns_http_unauthorized
55
+ @http_adapter.set_auth('wrong_username', 'wrong_password')
56
+ uri = URI(@http_url + '/basic-auth/user/passwd')
57
+ response = @http_adapter.get(uri)
58
+ assert_instance_of Net::HTTPUnauthorized, response
59
+ end
60
+
61
+ # GET method
62
+ def test_get_with_no_arguments_raises_argument_error
63
+ assert_raises ArgumentError do
64
+ @http_adapter.get()
65
+ end
66
+ end
67
+
68
+ def test_get_with_too_many_arguments_raises_argument_error
69
+ assert_raises ArgumentError do
70
+ uri = URI(@https_url + '/get')
71
+ @http_adapter.get(uri, 'too_many_arguments')
72
+ end
73
+ end
74
+
75
+ def test_http_methods_only_accepts_uri_object_as_first_argument
76
+ assert_raises CLX::CLXException do
77
+ @http_adapter.get(123)
78
+ end
79
+
80
+ assert_raises CLX::CLXException do
81
+ @http_adapter.get('')
82
+ end
83
+
84
+ assert_raises CLX::CLXException do
85
+ @http_adapter.get({key: 'value'})
86
+ end
87
+ end
88
+
89
+ def test_https_get_request_with_valid_url_returns_http_ok
90
+ uri = URI(@https_url + '/get')
91
+ response = @http_adapter.get(uri)
92
+ assert_instance_of Net::HTTPOK, response
93
+ end
94
+
95
+ def test_http_get_request_with_valid_url_returns_http_ok
96
+ uri = URI(@http_url + '/get')
97
+ response = @http_adapter.get(uri)
98
+ assert_instance_of Net::HTTPOK, response
99
+ end
100
+
101
+ # POST
102
+
103
+ def test_post_with_no_arguments_raises_argument_error
104
+ assert_raises ArgumentError do
105
+ @http_adapter.post()
106
+ end
107
+ end
108
+
109
+ def test_post_without_data_argument_raises_argument_error
110
+ assert_raises ArgumentError do
111
+ uri = URI(@https_url)
112
+ @http_adapter.post(uri)
113
+ end
114
+ end
115
+
116
+ def test_post_with_too_many_arguments_raises_argument_error
117
+ assert_raises ArgumentError do
118
+ uri = URI(@https_url + '/post')
119
+ @http_adapter.post(uri, {data: 1}, 'too_many_arguments')
120
+ end
121
+ end
122
+
123
+ def test_https_post_request_with_valid_url_returns_http_ok
124
+ uri = URI(@https_url + '/post')
125
+ response = @http_adapter.post(uri, {data: 1})
126
+ response_types = [Net::HTTPOK, Net::HTTPCreated]
127
+ assert_includes response_types, response.class
128
+ end
129
+
130
+ def test_http_post_request_with_valid_url_returns_http_ok
131
+ uri = URI(@http_url + '/post')
132
+ response = @http_adapter.post(uri, {data: 1})
133
+ response_types = [Net::HTTPOK, Net::HTTPCreated]
134
+ assert_includes response_types, response.class
135
+ end
136
+
137
+ # PUT
138
+ def test_put_with_no_arguments_should_raise_argument_error
139
+ assert_raises ArgumentError do
140
+ @http_adapter.put()
141
+ end
142
+ end
143
+
144
+ def test_put_without_data_argument_should_raise_argument_error
145
+ assert_raises ArgumentError do
146
+ uri = URI(@https_url + '/put')
147
+ @http_adapter.put(uri)
148
+ end
149
+ end
150
+
151
+ def test_put_with_too_many_arguments_raises_argument_error
152
+ assert_raises ArgumentError do
153
+ uri = URI(@https_url + '/put')
154
+ @http_adapter.put(uri, {data: 1}, 'too_many_arguments')
155
+ end
156
+ end
157
+
158
+ def test_https_put_request_with_valid_url_returns_http_ok
159
+ uri = URI(@https_url + '/put')
160
+ response = @http_adapter.put(uri, {data: 1})
161
+ assert_instance_of Net::HTTPOK, response
162
+ end
163
+
164
+ def test_http_put_request_with_valid_url_returns_http_ok
165
+ uri = URI(@http_url + '/put')
166
+ response = @http_adapter.put(uri, {data: 1})
167
+ assert_instance_of Net::HTTPOK, response
168
+ end
169
+
170
+ # DELETE
171
+ def test_delete_without_argument_should_raise_argument_error
172
+ assert_raises ArgumentError do
173
+ @http_adapter.delete()
174
+ end
175
+ end
176
+
177
+ def test_delete_with_too_many_arguments_should_raise_argument_error
178
+ assert_raises ArgumentError do
179
+ uri = URI(@https_url + '/delete')
180
+ @http_adapter.delete(uri, 'too_many_arguments')
181
+ end
182
+ end
183
+
184
+ def test_https_delete_request_with_valid_url_returns_http_ok
185
+ uri = URI(@https_url + '/delete')
186
+ response = @http_adapter.delete(uri)
187
+ response_types = [Net::HTTPOK, Net::HTTPNoContent]
188
+ assert_includes response_types, response.class
189
+ end
190
+
191
+ def test_http_delete_request_with_valid_url_returns_http_ok
192
+ uri = URI(@http_url + '/delete')
193
+ response = @http_adapter.delete(uri)
194
+ response_types = [Net::HTTPOK, Net::HTTPNoContent]
195
+ assert_includes response_types, response.class
196
+ end
197
+
198
+ # Manipulated adapter
199
+ def test_manipulated_adapter_with_invlaid_http_method_raises_clx_exception
200
+ def @http_adapter.fake_method(uri)
201
+ execute('FAKE_HTTP_METHOD', uri)
202
+ end
203
+
204
+ assert_raises CLX::CLXException do
205
+ uri = URI(@https_url + '/get')
206
+ response = @http_adapter.fake_method(uri)
207
+ end
208
+
209
+ end
210
+
211
+ end