diff --git a/fittrackee/tests/workouts/test_workouts_api_0_get.py b/fittrackee/tests/workouts/test_workouts_api_0_get.py index beba7c44..cafcb620 100644 --- a/fittrackee/tests/workouts/test_workouts_api_0_get.py +++ b/fittrackee/tests/workouts/test_workouts_api_0_get.py @@ -969,7 +969,7 @@ class TestGetWorkoutsWithFiltersAndPagination(ApiTestCaseMixin): class TestGetWorkout(ApiTestCaseMixin): - def test_it_gets_an_workout( + def test_it_gets_a_workout( self, app: Flask, user_1: User, @@ -1105,7 +1105,7 @@ class TestGetWorkout(ApiTestCaseMixin): response, f'no gpx file for this workout (id: {workout_short_id})' ) - def test_it_returns_500_on_getting_gpx_if_an_workout_has_invalid_gpx_pathname( # noqa + def test_it_returns_500_on_getting_gpx_if_a_workout_has_invalid_gpx_pathname( # noqa self, app: Flask, user_1: User, @@ -1125,7 +1125,7 @@ class TestGetWorkout(ApiTestCaseMixin): data = self.assert_500(response) assert 'data' not in data - def test_it_returns_500_on_getting_chart_data_if_an_workout_has_invalid_gpx_pathname( # noqa + def test_it_returns_500_on_getting_chart_data_if_a_workout_has_invalid_gpx_pathname( # noqa self, app: Flask, user_1: User, diff --git a/fittrackee/tests/workouts/test_workouts_api_1_post.py b/fittrackee/tests/workouts/test_workouts_api_1_post.py index f6ff5cac..5e56f003 100644 --- a/fittrackee/tests/workouts/test_workouts_api_1_post.py +++ b/fittrackee/tests/workouts/test_workouts_api_1_post.py @@ -222,7 +222,7 @@ class TestPostWorkoutWithGpx(ApiTestCaseMixin, CallArgsMixin): self.assert_401(response) - def test_it_adds_an_workout_with_gpx_file( + def test_it_adds_a_workout_with_gpx_file( self, app: Flask, user_1: User, sport_1_cycling: Sport, gpx_file: str ) -> None: client, auth_token = self.get_test_client_and_auth_token( @@ -248,7 +248,7 @@ class TestPostWorkoutWithGpx(ApiTestCaseMixin, CallArgsMixin): assert 'just a workout' == data['data']['workouts'][0]['title'] assert_workout_data_with_gpx(data) - def test_it_adds_an_workout_with_gpx_without_name( + def test_it_adds_a_workout_with_gpx_without_name( self, app: Flask, user_1: User, @@ -281,7 +281,7 @@ class TestPostWorkoutWithGpx(ApiTestCaseMixin, CallArgsMixin): ) assert_workout_data_with_gpx(data) - def test_it_adds_an_workout_with_gpx_without_name_timezone( + def test_it_adds_a_workout_with_gpx_without_name_timezone( self, app: Flask, user_1: User, @@ -606,7 +606,7 @@ class TestPostWorkoutWithoutGpx(ApiTestCaseMixin): self.assert_401(response) - def test_it_adds_an_workout_without_gpx( + def test_it_adds_a_workout_without_gpx( self, app: Flask, user_1: User, sport_1_cycling: Sport ) -> None: client, auth_token = self.get_test_client_and_auth_token( @@ -953,12 +953,12 @@ class TestPostAndGetWorkoutWithGpx(ApiTestCaseMixin): self.assert_500(response) - def test_it_gets_an_workout_created_with_gpx( + def test_it_gets_a_workout_created_with_gpx( self, app: Flask, user_1: User, sport_1_cycling: Sport, gpx_file: str ) -> None: return self.workout_assertion(app, user_1, gpx_file, False) - def test_it_gets_an_workout_created_with_gpx_with_segments( + def test_it_gets_a_workout_created_with_gpx_with_segments( self, app: Flask, user_1: User, @@ -969,7 +969,7 @@ class TestPostAndGetWorkoutWithGpx(ApiTestCaseMixin): app, user_1, gpx_file_with_segments, True ) - def test_it_gets_chart_data_for_an_workout_created_with_gpx( + def test_it_gets_chart_data_for_a_workout_created_with_gpx( self, app: Flask, user_1: User, sport_1_cycling: Sport, gpx_file: str ) -> None: client, auth_token = self.get_test_client_and_auth_token( @@ -1000,7 +1000,7 @@ class TestPostAndGetWorkoutWithGpx(ApiTestCaseMixin): assert data['message'] == '' assert data['data']['chart_data'] != '' - def test_it_gets_segment_chart_data_for_an_workout_created_with_gpx( + def test_it_gets_segment_chart_data_for_a_workout_created_with_gpx( self, app: Flask, user_1: User, sport_1_cycling: Sport, gpx_file: str ) -> None: client, auth_token = self.get_test_client_and_auth_token( @@ -1125,7 +1125,7 @@ class TestPostAndGetWorkoutWithGpx(ApiTestCaseMixin): class TestPostAndGetWorkoutWithoutGpx(ApiTestCaseMixin): - def test_it_add_and_gets_an_workout_wo_gpx( + def test_it_add_and_gets_a_workout_wo_gpx( self, app: Flask, user_1: User, sport_1_cycling: Sport ) -> None: client, auth_token = self.get_test_client_and_auth_token( @@ -1158,7 +1158,7 @@ class TestPostAndGetWorkoutWithoutGpx(ApiTestCaseMixin): assert len(data['data']['workouts']) == 1 assert_workout_data_wo_gpx(data) - def test_it_adds_and_gets_an_workout_wo_gpx_notes( + def test_it_adds_and_gets_a_workout_wo_gpx_notes( self, app: Flask, user_1: User, sport_1_cycling: Sport ) -> None: client, auth_token = self.get_test_client_and_auth_token( @@ -1194,7 +1194,7 @@ class TestPostAndGetWorkoutWithoutGpx(ApiTestCaseMixin): class TestPostAndGetWorkoutUsingTimezones(ApiTestCaseMixin): - def test_it_add_and_gets_an_workout_wo_gpx_with_timezone( + def test_it_add_and_gets_a_workout_wo_gpx_with_timezone( self, app: Flask, user_1: User, sport_1_cycling: Sport ) -> None: user_1.timezone = 'Europe/Paris' diff --git a/fittrackee/tests/workouts/test_workouts_api_2_patch.py b/fittrackee/tests/workouts/test_workouts_api_2_patch.py index 63bd919f..cf3143bc 100644 --- a/fittrackee/tests/workouts/test_workouts_api_2_patch.py +++ b/fittrackee/tests/workouts/test_workouts_api_2_patch.py @@ -9,7 +9,7 @@ from fittrackee.users.models import User from fittrackee.workouts.models import Sport, Workout from ..mixins import ApiTestCaseMixin -from .utils import get_random_short_id, post_an_workout +from .utils import get_random_short_id, post_a_workout def assert_workout_data_with_gpx(data: Dict, sport_id: int) -> None: @@ -56,7 +56,7 @@ def assert_workout_data_with_gpx(data: Dict, sport_id: int) -> None: class TestEditWorkoutWithGpx(ApiTestCaseMixin): - def test_it_updates_title_for_an_workout_with_gpx( + def test_it_updates_title_for_a_workout_with_gpx( self, app: Flask, user_1: User, @@ -64,7 +64,7 @@ class TestEditWorkoutWithGpx(ApiTestCaseMixin): sport_2_running: Sport, gpx_file: str, ) -> None: - token, workout_short_id = post_an_workout(app, gpx_file) + token, workout_short_id = post_a_workout(app, gpx_file) client = app.test_client() response = client.patch( @@ -100,7 +100,7 @@ class TestEditWorkoutWithGpx(ApiTestCaseMixin): sport_2_running: Sport, gpx_file: str, ) -> None: - token, workout_short_id = post_an_workout(app, gpx_file) + token, workout_short_id = post_a_workout(app, gpx_file) client = app.test_client() response = client.patch( @@ -124,7 +124,7 @@ class TestEditWorkoutWithGpx(ApiTestCaseMixin): sport_2_running: Sport, gpx_file: str, ) -> None: - token, workout_short_id = post_an_workout( + token, workout_short_id = post_a_workout( app, gpx_file, notes=uuid4().hex ) client = app.test_client() @@ -142,7 +142,7 @@ class TestEditWorkoutWithGpx(ApiTestCaseMixin): assert len(data['data']['workouts']) == 1 assert data['data']['workouts'][0]['notes'] == '' - def test_it_raises_403_when_editing_an_workout_from_different_user( + def test_it_raises_403_when_editing_a_workout_from_different_user( self, app: Flask, user_1: User, @@ -151,7 +151,7 @@ class TestEditWorkoutWithGpx(ApiTestCaseMixin): sport_2_running: Sport, gpx_file: str, ) -> None: - _, workout_short_id = post_an_workout(app, gpx_file) + _, workout_short_id = post_a_workout(app, gpx_file) client, auth_token = self.get_test_client_and_auth_token( app, user_2.email ) @@ -173,7 +173,7 @@ class TestEditWorkoutWithGpx(ApiTestCaseMixin): sport_2_running: Sport, gpx_file: str, ) -> None: - token, workout_short_id = post_an_workout(app, gpx_file) + token, workout_short_id = post_a_workout(app, gpx_file) client = app.test_client() response = client.patch( @@ -194,7 +194,7 @@ class TestEditWorkoutWithGpx(ApiTestCaseMixin): def test_it_returns_400_if_payload_is_empty( self, app: Flask, user_1: User, sport_1_cycling: Sport, gpx_file: str ) -> None: - token, workout_short_id = post_an_workout(app, gpx_file) + token, workout_short_id = post_a_workout(app, gpx_file) client = app.test_client() response = client.patch( @@ -209,7 +209,7 @@ class TestEditWorkoutWithGpx(ApiTestCaseMixin): def test_it_raises_500_if_sport_does_not_exists( self, app: Flask, user_1: User, sport_1_cycling: Sport, gpx_file: str ) -> None: - token, workout_short_id = post_an_workout(app, gpx_file) + token, workout_short_id = post_a_workout(app, gpx_file) client = app.test_client() response = client.patch( @@ -223,7 +223,7 @@ class TestEditWorkoutWithGpx(ApiTestCaseMixin): class TestEditWorkoutWithoutGpx(ApiTestCaseMixin): - def test_it_updates_an_workout_wo_gpx( + def test_it_updates_a_workout_wo_gpx( self, app: Flask, user_1: User, @@ -364,7 +364,7 @@ class TestEditWorkoutWithoutGpx(ApiTestCaseMixin): assert len(data['data']['workouts']) == 1 assert data['data']['workouts'][0]['notes'] == '' - def test_returns_403_when_editing_an_workout_wo_gpx_from_different_user( + def test_returns_403_when_editing_a_workout_wo_gpx_from_different_user( self, app: Flask, user_1: User, @@ -393,7 +393,7 @@ class TestEditWorkoutWithoutGpx(ApiTestCaseMixin): self.assert_403(response) - def test_it_updates_an_workout_wo_gpx_with_timezone( + def test_it_updates_a_workout_wo_gpx_with_timezone( self, app: Flask, user_1_paris: User, @@ -468,7 +468,7 @@ class TestEditWorkoutWithoutGpx(ApiTestCaseMixin): assert records[3]['workout_date'] == 'Tue, 15 May 2018 13:05:00 GMT' assert records[3]['value'] == 8.0 - def test_it_updates_only_sport_and_distance_an_workout_wo_gpx( + def test_it_updates_only_sport_and_distance_a_workout_wo_gpx( self, app: Flask, user_1: User, diff --git a/fittrackee/tests/workouts/test_workouts_api_3_delete.py b/fittrackee/tests/workouts/test_workouts_api_3_delete.py index d6c9adfe..86c5684f 100644 --- a/fittrackee/tests/workouts/test_workouts_api_3_delete.py +++ b/fittrackee/tests/workouts/test_workouts_api_3_delete.py @@ -7,7 +7,7 @@ from fittrackee.users.models import User from fittrackee.workouts.models import Sport, Workout from ..mixins import ApiTestCaseMixin -from .utils import get_random_short_id, post_an_workout +from .utils import get_random_short_id, post_a_workout def get_gpx_filepath(workout_id: int) -> str: @@ -16,10 +16,10 @@ def get_gpx_filepath(workout_id: int) -> str: class TestDeleteWorkoutWithGpx(ApiTestCaseMixin): - def test_it_deletes_an_workout_with_gpx( + def test_it_deletes_a_workout_with_gpx( self, app: Flask, user_1: User, sport_1_cycling: Sport, gpx_file: str ) -> None: - token, workout_short_id = post_an_workout(app, gpx_file) + token, workout_short_id = post_a_workout(app, gpx_file) client = app.test_client() response = client.delete( @@ -29,7 +29,7 @@ class TestDeleteWorkoutWithGpx(ApiTestCaseMixin): assert response.status_code == 204 - def test_it_returns_403_when_deleting_an_workout_from_different_user( + def test_it_returns_403_when_deleting_a_workout_from_different_user( self, app: Flask, user_1: User, @@ -37,7 +37,7 @@ class TestDeleteWorkoutWithGpx(ApiTestCaseMixin): sport_1_cycling: Sport, gpx_file: str, ) -> None: - _, workout_short_id = post_an_workout(app, gpx_file) + _, workout_short_id = post_a_workout(app, gpx_file) client, auth_token = self.get_test_client_and_auth_token( app, user_2.email ) @@ -64,10 +64,10 @@ class TestDeleteWorkoutWithGpx(ApiTestCaseMixin): data = self.assert_404(response) assert 'not found' in data['status'] - def test_it_returns_500_when_deleting_an_workout_with_gpx_invalid_file( + def test_it_returns_500_when_deleting_a_workout_with_gpx_invalid_file( self, app: Flask, user_1: User, sport_1_cycling: Sport, gpx_file: str ) -> None: - token, workout_short_id = post_an_workout(app, gpx_file) + token, workout_short_id = post_a_workout(app, gpx_file) client = app.test_client() gpx_filepath = get_gpx_filepath(1) gpx_filepath = get_absolute_file_path(gpx_filepath) @@ -82,7 +82,7 @@ class TestDeleteWorkoutWithGpx(ApiTestCaseMixin): class TestDeleteWorkoutWithoutGpx(ApiTestCaseMixin): - def test_it_deletes_an_workout_wo_gpx( + def test_it_deletes_a_workout_wo_gpx( self, app: Flask, user_1: User, @@ -98,7 +98,7 @@ class TestDeleteWorkoutWithoutGpx(ApiTestCaseMixin): ) assert response.status_code == 204 - def test_it_returns_403_when_deleting_an_workout_from_different_user( + def test_it_returns_403_when_deleting_a_workout_from_different_user( self, app: Flask, user_1: User, diff --git a/fittrackee/tests/workouts/utils.py b/fittrackee/tests/workouts/utils.py index 7aaea2f6..43bc65a9 100644 --- a/fittrackee/tests/workouts/utils.py +++ b/fittrackee/tests/workouts/utils.py @@ -12,7 +12,7 @@ def get_random_short_id() -> str: return encode_uuid(uuid4()) -def post_an_workout( +def post_a_workout( app: Flask, gpx_file: str, notes: Optional[str] = None ) -> Tuple[str, str]: client = app.test_client() diff --git a/fittrackee/workouts/workouts.py b/fittrackee/workouts/workouts.py index d747c128..b5d90a32 100644 --- a/fittrackee/workouts/workouts.py +++ b/fittrackee/workouts/workouts.py @@ -303,7 +303,7 @@ def get_workout( auth_user: User, workout_short_id: str ) -> Union[Dict, HttpResponse]: """ - Get an workout + Get a workout **Example request**: @@ -405,7 +405,7 @@ def get_workout_data( data_type: str, segment_id: Optional[int] = None, ) -> Union[Dict, HttpResponse]: - """Get data from an workout gpx file""" + """Get data from a workout gpx file""" workout_uuid = decode_short_id(workout_short_id) workout = Workout.query.filter_by(uuid=workout_uuid).first() if not workout: @@ -467,7 +467,7 @@ def get_workout_gpx( auth_user: User, workout_short_id: str ) -> Union[Dict, HttpResponse]: """ - Get gpx file for an workout displayed on map with Leaflet + Get gpx file for a workout displayed on map with Leaflet **Example request**: @@ -517,7 +517,7 @@ def get_workout_chart_data( auth_user: User, workout_short_id: str ) -> Union[Dict, HttpResponse]: """ - Get chart data from an workout gpx file, to display it with Recharts + Get chart data from a workout gpx file, to display it with Recharts **Example request**: @@ -587,7 +587,7 @@ def get_segment_gpx( auth_user: User, workout_short_id: str, segment_id: int ) -> Union[Dict, HttpResponse]: """ - Get gpx file for an workout segment displayed on map with Leaflet + Get gpx file for a workout segment displayed on map with Leaflet **Example request**: @@ -639,7 +639,7 @@ def get_segment_chart_data( auth_user: User, workout_short_id: str, segment_id: int ) -> Union[Dict, HttpResponse]: """ - Get chart data from an workout gpx file, to display it with Recharts + Get chart data from a workout gpx file, to display it with Recharts **Example request**: @@ -851,7 +851,7 @@ def get_map_tile(s: str, z: str, x: str, y: str) -> Tuple[Response, int]: @authenticate def post_workout(auth_user: User) -> Union[Tuple[Dict, int], HttpResponse]: """ - Post an workout with a gpx file + Post a workout with a gpx file **Example request**: @@ -1021,7 +1021,7 @@ def post_workout_no_gpx( auth_user: User, ) -> Union[Tuple[Dict, int], HttpResponse]: """ - Post an workout without gpx file + Post a workout without gpx file **Example request**: @@ -1169,7 +1169,7 @@ def update_workout( auth_user: User, workout_short_id: str ) -> Union[Dict, HttpResponse]: """ - Update an workout + Update a workout **Example request**: @@ -1316,7 +1316,7 @@ def delete_workout( auth_user: User, workout_short_id: str ) -> Union[Tuple[Dict, int], HttpResponse]: """ - Delete an workout + Delete a workout **Example request**: