diff --git a/passerelle/apps/astech/models.py b/passerelle/apps/astech/models.py index dadf55af..50b20f3c 100644 --- a/passerelle/apps/astech/models.py +++ b/passerelle/apps/astech/models.py @@ -161,7 +161,7 @@ class ASTech(BaseResource, HTTPResource): try: content = response.json() except ValueError: - content = response.content[:1024] + content = '%r' % response.content[:1024] raise APIError( 'AS-TECH response: %s %s' % (response.status_code, response.reason), data={ diff --git a/tests/test_astech.py b/tests/test_astech.py index b25637de..0c86a431 100644 --- a/tests/test_astech.py +++ b/tests/test_astech.py @@ -136,7 +136,7 @@ def test_connections(mocked_request, app, setup): assert response.json['err_class'].endswith('APIError') assert response.json['err_desc'] == 'AS-TECH response: 500 Crashhhh' assert response.json['data']['error']['status'] == 500 - assert response.json['data']['error']['content'] == 'crash' + assert 'crash' in response.json['data']['error']['content'] mocked_request.return_value = tests.utils.FakedResponse(content='not json', status_code=200, reason='OK') response = app.get(endpoint) assert response.json['err'] == 1