API - minor changes (docs, tests)

This commit is contained in:
Sam 2022-12-21 09:40:49 +01:00
parent 766f0b69fa
commit 4011afc07a
3 changed files with 11 additions and 9 deletions

View File

@ -578,7 +578,7 @@ class TestEditWorkoutWithoutGpx(ApiTestCaseMixin):
assert records[3]['workout_date'] == 'Mon, 01 Jan 2018 00:00:00 GMT' assert records[3]['workout_date'] == 'Mon, 01 Jan 2018 00:00:00 GMT'
assert records[3]['value'] == 20.0 assert records[3]['value'] == 20.0
def test_it_updates_elevation_values( def test_it_updates_ascent_and_descent_values(
self, self,
app: Flask, app: Flask,
user_1: User, user_1: User,
@ -634,7 +634,7 @@ class TestEditWorkoutWithoutGpx(ApiTestCaseMixin):
assert records[4]['workout_date'] == 'Mon, 01 Jan 2018 00:00:00 GMT' assert records[4]['workout_date'] == 'Mon, 01 Jan 2018 00:00:00 GMT'
assert records[4]['value'] == 10.0 assert records[4]['value'] == 10.0
def test_it_empties_elevation_values( def test_it_empties_ascent_and_descent_values(
self, self,
app: Flask, app: Flask,
user_1: User, user_1: User,
@ -745,7 +745,7 @@ class TestEditWorkoutWithoutGpx(ApiTestCaseMixin):
('O', 150), ('O', 150),
], ],
) )
def test_it_returns_400_if_elevation_is_invalid( def test_it_returns_400_if_ascent_or_descent_are_invalid(
self, self,
app: Flask, app: Flask,
user_1: User, user_1: User,
@ -775,7 +775,7 @@ class TestEditWorkoutWithoutGpx(ApiTestCaseMixin):
'input_key', 'input_key',
['ascent', 'descent'], ['ascent', 'descent'],
) )
def test_it_returns_400_if_only_one_elevation_value_is_provided( def test_it_returns_400_if_only_one_value_ascent_or_descent_is_provided(
self, self,
app: Flask, app: Flask,
user_1: User, user_1: User,

View File

@ -75,7 +75,7 @@ class TestWorkoutModel:
assert serialized_workout['with_gpx'] is False assert serialized_workout['with_gpx'] is False
assert str(serialized_workout['workout_date']) == '2018-01-01 00:00:00' assert str(serialized_workout['workout_date']) == '2018-01-01 00:00:00'
def test_serialize_for_workout_without_gpx_and_with_elevation( def test_serialize_for_workout_without_gpx_and_with_ascent_and_descent(
self, self,
app: Flask, app: Flask,
sport_1_cycling: Sport, sport_1_cycling: Sport,

View File

@ -1132,8 +1132,10 @@ def post_workout_no_gpx(
"status": "success" "status": "success"
} }
:<json float ascent: workout ascent (not mandatory) :<json float ascent: workout ascent (not mandatory,
:<json float descent: workout descent (not mandatory) must be provided with descent)
:<json float descent: workout descent (not mandatory,
must be provided with ascent)
:<json float distance: workout distance in km :<json float distance: workout distance in km
:<json integer duration: workout duration in seconds :<json integer duration: workout duration in seconds
:<json string notes: notes (not mandatory) :<json string notes: notes (not mandatory)
@ -1302,9 +1304,9 @@ def update_workout(
:param string workout_short_id: workout short id :param string workout_short_id: workout short id
:<json float ascent: workout ascent :<json float ascent: workout ascent
(only for workout without gpx) (only for workout without gpx, must be provided with descent)
:<json float descent: workout descent :<json float descent: workout descent
(only for workout without gpx) (only for workout without gpx, must be provided with ascent)
:<json float distance: workout distance in km :<json float distance: workout distance in km
(only for workout without gpx) (only for workout without gpx)
:<json integer duration: workout duration in seconds :<json integer duration: workout duration in seconds