astech: don't use bytes in APIError content (#83342)
gitea/passerelle/pipeline/head This commit looks good
Details
gitea/passerelle/pipeline/head This commit looks good
Details
This commit is contained in:
parent
81f58cad59
commit
0a28034137
|
@ -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={
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue