api_entreprise: use response text when error (#38781)

This commit is contained in:
Emmanuel Cazenave 2020-01-13 18:46:32 +01:00
parent 658265ff53
commit 049266ba2d
2 changed files with 2 additions and 2 deletions

View File

@ -100,7 +100,7 @@ class APIEntreprise(BaseResource):
try:
data = response.json()
except ValueError as e:
content = repr(response.content[:1000])
content = response.text[:1000]
raise APIError(
u'API-entreprise returned non-JSON content with status %s: %s' %
(response.status_code, content),

View File

@ -453,7 +453,7 @@ def test_no_json_error(app, resource, mock_api_entreprise):
params=REQUEST_PARAMS)
assert response.status_code == 200
assert response.json['err'] == 1
assert response.json['err_desc'] == "API-entreprise returned non-JSON content with status 200: 'simple text'"
assert response.json['err_desc'] == "API-entreprise returned non-JSON content with status 200: simple text"
def test_error_404(app, resource, mock_api_entreprise):