API - refactor api responses
This commit is contained in:
@ -833,7 +833,7 @@ class TestGetActivity:
|
||||
|
||||
data = json.loads(response.data.decode())
|
||||
assert response.status_code == 404
|
||||
assert 'error' in data['status']
|
||||
assert 'not found' in data['status']
|
||||
assert (
|
||||
f'No gpx file for this activity (id: {activity_short_id})'
|
||||
in data['message']
|
||||
@ -860,7 +860,7 @@ class TestGetActivity:
|
||||
|
||||
data = json.loads(response.data.decode())
|
||||
assert response.status_code == 404
|
||||
assert 'error' in data['status']
|
||||
assert 'not found' in data['status']
|
||||
assert (
|
||||
f'No gpx file for this activity (id: {activity_short_id})'
|
||||
in data['message']
|
||||
@ -888,7 +888,10 @@ class TestGetActivity:
|
||||
data = json.loads(response.data.decode())
|
||||
assert response.status_code == 500
|
||||
assert 'error' in data['status']
|
||||
assert 'internal error' in data['message']
|
||||
assert (
|
||||
'Error. Please try again or contact the administrator.'
|
||||
in data['message']
|
||||
)
|
||||
assert 'data' not in data
|
||||
|
||||
def test_it_returns_500_on_getting_chart_data_if_an_activity_has_invalid_gpx_pathname( # noqa
|
||||
@ -913,7 +916,10 @@ class TestGetActivity:
|
||||
data = json.loads(response.data.decode())
|
||||
assert response.status_code == 500
|
||||
assert 'error' in data['status']
|
||||
assert 'internal error' in data['message']
|
||||
assert (
|
||||
'Error. Please try again or contact the administrator.'
|
||||
in data['message']
|
||||
)
|
||||
assert 'data' not in data
|
||||
|
||||
def test_it_returns_404_if_activity_has_no_map(self, app, user_1):
|
||||
@ -933,5 +939,5 @@ class TestGetActivity:
|
||||
data = json.loads(response.data.decode())
|
||||
|
||||
assert response.status_code == 404
|
||||
assert 'error' in data['status']
|
||||
assert 'not found' in data['status']
|
||||
assert 'Map does not exist' in data['message']
|
||||
|
@ -843,7 +843,10 @@ class TestPostAndGetActivityWithGpx:
|
||||
|
||||
assert response.status_code == 500
|
||||
assert data['status'] == 'error'
|
||||
assert data['message'] == 'internal error.'
|
||||
assert (
|
||||
data['message']
|
||||
== 'Error. Please try again or contact the administrator.'
|
||||
)
|
||||
|
||||
def test_it_gets_an_activity_created_with_gpx(
|
||||
self, app, user_1, sport_1_cycling, gpx_file
|
||||
|
Reference in New Issue
Block a user