|
@@ -248,14 +248,15 @@ class TestOutputControllerWrapper(Base):
|
248
|
248
|
|
249
|
249
|
result = func(42)
|
250
|
250
|
assert HTTPStatus.INTERNAL_SERVER_ERROR == result.status_code
|
251
|
|
- # see MyProcessor#process
|
252
|
|
- assert isinstance(result, dict)
|
253
|
|
- assert 'http_code' in result
|
254
|
|
- assert result['http_code'] == HTTPStatus.INTERNAL_SERVER_ERROR
|
255
|
|
- assert 'original_error' in result
|
256
|
|
- assert result['original_error'].details == {
|
257
|
|
- 'name': ['Missing data for required field.']
|
258
|
|
- }
|
|
251
|
+ assert {
|
|
252
|
+ 'original_error': {
|
|
253
|
+ 'details': {
|
|
254
|
+ 'name': ['Missing data for required field.']
|
|
255
|
+ },
|
|
256
|
+ 'message': 'Validation error of output data'
|
|
257
|
+ },
|
|
258
|
+ 'http_code': 500,
|
|
259
|
+ } == json.loads(result.body)
|
259
|
260
|
|
260
|
261
|
|
261
|
262
|
class TestExceptionHandlerControllerWrapper(Base):
|
|
@@ -273,14 +274,12 @@ class TestExceptionHandlerControllerWrapper(Base):
|
273
|
274
|
raise ZeroDivisionError('We are testing')
|
274
|
275
|
|
275
|
276
|
response = func(42)
|
276
|
|
- assert 'http_code' in response
|
277
|
|
- assert response['http_code'] == HTTPStatus.INTERNAL_SERVER_ERROR
|
278
|
|
- assert 'original_response' in response
|
279
|
|
- assert json.loads(response['original_response']) == {
|
280
|
|
- 'message': 'We are testing',
|
281
|
|
- 'details': {},
|
282
|
|
- 'code': None,
|
283
|
|
- }
|
|
277
|
+ assert HTTPStatus.INTERNAL_SERVER_ERROR == response.status_code
|
|
278
|
+ assert {
|
|
279
|
+ 'details': {},
|
|
280
|
+ 'message': 'We are testing',
|
|
281
|
+ 'code': None,
|
|
282
|
+ } == json.loads(response.body)
|
284
|
283
|
|
285
|
284
|
def test_unit__exception_handled__ok__exception_error_dict(self):
|
286
|
285
|
class MyException(Exception):
|