Update post tests for HA

This commit is contained in:
Fmstrat 2022-07-18 11:27:50 -04:00
parent a8d4c470bb
commit a22096e652

View File

@ -133,7 +133,7 @@ def assert_workout_data_with_gpx_segments(data: Dict) -> None:
assert segment['pauses'] is None assert segment['pauses'] is None
records = data['data']['workouts'][0]['records'] records = data['data']['workouts'][0]['records']
assert len(records) == 4 assert len(records) == 5
assert records[0]['sport_id'] == 1 assert records[0]['sport_id'] == 1
assert records[0]['workout_id'] == data['data']['workouts'][0]['id'] assert records[0]['workout_id'] == data['data']['workouts'][0]['id']
assert records[0]['record_type'] == 'MS' assert records[0]['record_type'] == 'MS'
@ -146,14 +146,18 @@ def assert_workout_data_with_gpx_segments(data: Dict) -> None:
assert records[1]['value'] == '0:03:55' assert records[1]['value'] == '0:03:55'
assert records[2]['sport_id'] == 1 assert records[2]['sport_id'] == 1
assert records[2]['workout_id'] == data['data']['workouts'][0]['id'] assert records[2]['workout_id'] == data['data']['workouts'][0]['id']
assert records[2]['record_type'] == 'FD' assert records[2]['record_type'] == 'HA'
assert records[2]['workout_date'] == 'Tue, 13 Mar 2018 12:44:45 GMT' assert records[2]['workout_date'] == 'Tue, 13 Mar 2018 12:44:45 GMT'
assert records[2]['value'] == 0.3
assert records[3]['sport_id'] == 1 assert records[3]['sport_id'] == 1
assert records[3]['workout_id'] == data['data']['workouts'][0]['id'] assert records[3]['workout_id'] == data['data']['workouts'][0]['id']
assert records[3]['record_type'] == 'AS' assert records[3]['record_type'] == 'FD'
assert records[3]['workout_date'] == 'Tue, 13 Mar 2018 12:44:45 GMT' assert records[3]['workout_date'] == 'Tue, 13 Mar 2018 12:44:45 GMT'
assert records[3]['value'] == 4.59 assert records[3]['value'] == 0.3
assert records[4]['sport_id'] == 1
assert records[4]['workout_id'] == data['data']['workouts'][0]['id']
assert records[4]['record_type'] == 'AS'
assert records[4]['workout_date'] == 'Tue, 13 Mar 2018 12:44:45 GMT'
assert records[4]['value'] == 4.59
def assert_workout_data_wo_gpx(data: Dict) -> None: def assert_workout_data_wo_gpx(data: Dict) -> None:
@ -186,7 +190,7 @@ def assert_workout_data_wo_gpx(data: Dict) -> None:
assert len(data['data']['workouts'][0]['segments']) == 0 assert len(data['data']['workouts'][0]['segments']) == 0
records = data['data']['workouts'][0]['records'] records = data['data']['workouts'][0]['records']
assert len(records) == 4 assert len(records) == 5
assert records[0]['sport_id'] == 1 assert records[0]['sport_id'] == 1
assert records[0]['workout_id'] == data['data']['workouts'][0]['id'] assert records[0]['workout_id'] == data['data']['workouts'][0]['id']
assert records[0]['record_type'] == 'MS' assert records[0]['record_type'] == 'MS'
@ -199,14 +203,18 @@ def assert_workout_data_wo_gpx(data: Dict) -> None:
assert records[1]['value'] == '1:00:00' assert records[1]['value'] == '1:00:00'
assert records[2]['sport_id'] == 1 assert records[2]['sport_id'] == 1
assert records[2]['workout_id'] == data['data']['workouts'][0]['id'] assert records[2]['workout_id'] == data['data']['workouts'][0]['id']
assert records[2]['record_type'] == 'FD' assert records[2]['record_type'] == 'HA'
assert records[2]['workout_date'] == 'Tue, 15 May 2018 14:05:00 GMT' assert records[2]['workout_date'] == 'Tue, 15 May 2018 14:05:00 GMT'
assert records[2]['value'] == 10.0
assert records[3]['sport_id'] == 1 assert records[3]['sport_id'] == 1
assert records[3]['workout_id'] == data['data']['workouts'][0]['id'] assert records[3]['workout_id'] == data['data']['workouts'][0]['id']
assert records[3]['record_type'] == 'AS' assert records[3]['record_type'] == 'FD'
assert records[3]['workout_date'] == 'Tue, 15 May 2018 14:05:00 GMT' assert records[3]['workout_date'] == 'Tue, 15 May 2018 14:05:00 GMT'
assert records[3]['value'] == 10.0 assert records[3]['value'] == 10.0
assert records[4]['sport_id'] == 1
assert records[4]['workout_id'] == data['data']['workouts'][0]['id']
assert records[4]['record_type'] == 'AS'
assert records[4]['workout_date'] == 'Tue, 15 May 2018 14:05:00 GMT'
assert records[4]['value'] == 10.0
class TestPostWorkoutWithGpx(ApiTestCaseMixin, CallArgsMixin): class TestPostWorkoutWithGpx(ApiTestCaseMixin, CallArgsMixin):