Skip to content

Commit 7bec827

Browse files
committed
Fix test_http_signature
1 parent a1771b4 commit 7bec827

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

samples/openapi3/client/petstore/python-lazyImports/tests/test_http_signature.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ def request(self, *actual_request_target, **actual_request_headers_and_body):
102102
self._tc.assertIn(k, actual_request_headers_and_body)
103103
if k == 'body':
104104
actual_body = actual_request_headers_and_body[k]
105-
self._tc.assertEqual(expected, actual_body)
105+
actual_headers = actual_request_headers_and_body.get("headers", {})
106+
if actual_headers.get('Content-Type') == 'application/json':
107+
self._tc.assertEqual(json.loads(expected), json.loads(actual_body))
108+
else:
109+
self._tc.assertEqual(expected, actual_body)
106110
elif k == 'headers':
107111
actual_headers = actual_request_headers_and_body[k]
108112
for expected_header_name, expected_header_value in expected.items():

samples/openapi3/client/petstore/python-pydantic-v1/tests/test_http_signature.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,11 @@ def request(self, *actual_request_target, **actual_request_headers_and_body):
8585
self._tc.assertIn(k, actual_request_headers_and_body)
8686
if k == 'body':
8787
actual_body = actual_request_headers_and_body[k]
88-
self._tc.assertEqual(expected, actual_body)
88+
actual_headers = actual_request_headers_and_body.get("headers", {})
89+
if actual_headers.get('Content-Type') == 'application/json':
90+
self._tc.assertEqual(json.loads(expected), json.loads(actual_body))
91+
else:
92+
self._tc.assertEqual(expected, actual_body)
8993
elif k == 'headers':
9094
actual_headers = actual_request_headers_and_body[k]
9195
for expected_header_name, expected_header_value in expected.items():

samples/openapi3/client/petstore/python/tests/test_http_signature.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ def request(self, *actual_request_target, **actual_request_headers_and_body):
102102
self._tc.assertIn(k, actual_request_headers_and_body)
103103
if k == 'body':
104104
actual_body = actual_request_headers_and_body[k]
105-
self._tc.assertEqual(expected, actual_body)
105+
actual_headers = actual_request_headers_and_body.get("headers", {})
106+
if actual_headers.get('Content-Type') == 'application/json':
107+
self._tc.assertEqual(json.loads(expected), json.loads(actual_body))
108+
else:
109+
self._tc.assertEqual(expected, actual_body)
106110
elif k == 'headers':
107111
actual_headers = actual_request_headers_and_body[k]
108112
for expected_header_name, expected_header_value in expected.items():

0 commit comments

Comments
 (0)