Bastien Sevajol 6 yıl önce
ebeveyn
işleme
fde2865cf2
1 değiştirilmiş dosya ile 7 ekleme ve 5 silme
  1. 7 5
      tests/unit/test_decorator.py

+ 7 - 5
tests/unit/test_decorator.py Dosyayı Görüntüle

1
 # -*- coding: utf-8 -*-
1
 # -*- coding: utf-8 -*-
2
+import json
3
+
2
 import pytest
4
 import pytest
3
 import typing
5
 import typing
4
 
6
 
234
         # see MyProcessor#process
236
         # see MyProcessor#process
235
         assert {
237
         assert {
236
                    'http_code': HTTPStatus.OK,
238
                    'http_code': HTTPStatus.OK,
237
-                   'original_response': 43,
239
+                   'original_response': '43',
238
                } == result
240
                } == result
239
 
241
 
240
     def test_unit__output_data_wrapping__fail__error_response(self):
242
     def test_unit__output_data_wrapping__fail__error_response(self):
276
         assert 'http_code' in response
278
         assert 'http_code' in response
277
         assert response['http_code'] == HTTPStatus.INTERNAL_SERVER_ERROR
279
         assert response['http_code'] == HTTPStatus.INTERNAL_SERVER_ERROR
278
         assert 'original_response' in response
280
         assert 'original_response' in response
279
-        assert response['original_response'] == {
281
+        assert response['original_response'] == json.dumps({
280
             'message': 'We are testing',
282
             'message': 'We are testing',
281
             'code': None,
283
             'code': None,
282
             'details': {},
284
             'details': {},
283
-        }
285
+        })
284
 
286
 
285
     def test_unit__exception_handled__ok__exception_error_dict(self):
287
     def test_unit__exception_handled__ok__exception_error_dict(self):
286
         class MyException(Exception):
288
         class MyException(Exception):
306
         assert 'http_code' in response
308
         assert 'http_code' in response
307
         assert response['http_code'] == HTTPStatus.INTERNAL_SERVER_ERROR
309
         assert response['http_code'] == HTTPStatus.INTERNAL_SERVER_ERROR
308
         assert 'original_response' in response
310
         assert 'original_response' in response
309
-        assert response['original_response'] == {
311
+        assert response['original_response'] == json.dumps({
310
             'message': 'We are testing',
312
             'message': 'We are testing',
311
             'code': None,
313
             'code': None,
312
             'details': {'foo': 'bar'},
314
             'details': {'foo': 'bar'},
313
-        }
315
+        })
314
 
316
 
315
     def test_unit__exception_handler__error__error_content_malformed(self):
317
     def test_unit__exception_handler__error__error_content_malformed(self):
316
         class MyException(Exception):
318
         class MyException(Exception):