Show More
@@ -132,6 +132,9 b' class JSONRPCController(WSGIController):' | |||
|
132 | 132 | self._req_id = json_body['id'] |
|
133 | 133 | self._req_method = json_body['method'] |
|
134 | 134 | self._request_params = json_body['args'] |
|
135 | if not isinstance(self._request_params, dict): | |
|
136 | self._request_params = {} | |
|
137 | ||
|
135 | 138 | log.debug( |
|
136 | 139 | 'method: %s, params: %s' % (self._req_method, |
|
137 | 140 | self._request_params) |
@@ -212,6 +215,7 b' class JSONRPCController(WSGIController):' | |||
|
212 | 215 | ) |
|
213 | 216 | |
|
214 | 217 | self._rpc_args = {USER_SESSION_ATTR: u} |
|
218 | ||
|
215 | 219 | self._rpc_args.update(self._request_params) |
|
216 | 220 | |
|
217 | 221 | self._rpc_args['action'] = self._req_method |
@@ -155,6 +155,34 b' class BaseTestApi(object):' | |||
|
155 | 155 | expected = 'Missing non optional `repoid` arg in JSON DATA' |
|
156 | 156 | self._compare_error(id_, expected, given=response.body) |
|
157 | 157 | |
|
158 | def test_api_missing_non_optional_param_args_null(self): | |
|
159 | id_, params = _build_data(self.apikey, 'get_repo') | |
|
160 | params = params.replace('"args": {}', '"args": null') | |
|
161 | response = api_call(self, params) | |
|
162 | ||
|
163 | expected = 'Missing non optional `repoid` arg in JSON DATA' | |
|
164 | self._compare_error(id_, expected, given=response.body) | |
|
165 | ||
|
166 | def test_api_missing_non_optional_param_args_bad(self): | |
|
167 | id_, params = _build_data(self.apikey, 'get_repo') | |
|
168 | params = params.replace('"args": {}', '"args": 1') | |
|
169 | response = api_call(self, params) | |
|
170 | ||
|
171 | expected = 'Missing non optional `repoid` arg in JSON DATA' | |
|
172 | self._compare_error(id_, expected, given=response.body) | |
|
173 | ||
|
174 | def test_api_args_is_null(self): | |
|
175 | id_, params = _build_data(self.apikey, 'get_users',) | |
|
176 | params = params.replace('"args": {}', '"args": null') | |
|
177 | response = api_call(self, params) | |
|
178 | self.assertEqual(response.status, '200 OK') | |
|
179 | ||
|
180 | def test_api_args_is_bad(self): | |
|
181 | id_, params = _build_data(self.apikey, 'get_users',) | |
|
182 | params = params.replace('"args": {}', '"args": 1') | |
|
183 | response = api_call(self, params) | |
|
184 | self.assertEqual(response.status, '200 OK') | |
|
185 | ||
|
158 | 186 | def test_api_get_users(self): |
|
159 | 187 | id_, params = _build_data(self.apikey, 'get_users',) |
|
160 | 188 | response = api_call(self, params) |
General Comments 0
You need to be logged in to leave comments.
Login now