API - lint fix since black upgrade
This commit is contained in:
		| @@ -18,7 +18,6 @@ XDIST_WORKER = ( | ||||
|  | ||||
|  | ||||
| class BaseConfig: | ||||
|  | ||||
|     DEBUG = False | ||||
|     TESTING = False | ||||
|     SQLALCHEMY_TRACK_MODIFICATIONS = False | ||||
|   | ||||
| @@ -90,7 +90,6 @@ class TestEmailServiceUrlParser(CallArgsMixin): | ||||
|  | ||||
|  | ||||
| class TestEmailServiceSend(CallArgsMixin): | ||||
|  | ||||
|     email_data = { | ||||
|         'expiration_delay': '3 seconds', | ||||
|         'username': 'test', | ||||
| @@ -112,7 +111,6 @@ class TestEmailServiceSend(CallArgsMixin): | ||||
|     def test_it_sends_message( | ||||
|         self, mock_smtp: Mock, mock_smtp_ssl: Mock, app: Flask | ||||
|     ) -> None: | ||||
|  | ||||
|         email_service.send( | ||||
|             template='password_reset_request', | ||||
|             lang='en', | ||||
| @@ -164,7 +162,6 @@ class TestEmailServiceSend(CallArgsMixin): | ||||
|     def test_it_sends_message_without_authentication( | ||||
|         self, mock_smtp: Mock, mock_smtp_ssl: Mock, app_wo_email_auth: Flask | ||||
|     ) -> None: | ||||
|  | ||||
|         email_service.send( | ||||
|             template='password_reset_request', | ||||
|             lang='en', | ||||
|   | ||||
| @@ -33,7 +33,6 @@ class TestCreateOAuth2Client: | ||||
|         with patch( | ||||
|             'fittrackee.oauth2.client.gen_salt', return_value=client_id | ||||
|         ): | ||||
|  | ||||
|             oauth_client = create_oauth2_client(TEST_METADATA, user_1) | ||||
|  | ||||
|         assert oauth_client.client_id == client_id | ||||
| @@ -157,7 +156,6 @@ class TestCreateOAuth2Client: | ||||
|         with patch( | ||||
|             'fittrackee.oauth2.client.gen_salt', return_value=client_secret | ||||
|         ): | ||||
|  | ||||
|             oauth_client = create_oauth2_client(TEST_METADATA, user_1) | ||||
|  | ||||
|         assert oauth_client.client_secret == client_secret | ||||
|   | ||||
| @@ -139,7 +139,6 @@ class TestOAuthClientCreation(ApiTestCaseMixin): | ||||
|             'fittrackee.oauth2.client.gen_salt', | ||||
|             side_effect=[client_id, client_secret], | ||||
|         ): | ||||
|  | ||||
|             response = client.post( | ||||
|                 self.route, | ||||
|                 data=json.dumps(TEST_OAUTH_CLIENT_METADATA), | ||||
|   | ||||
| @@ -2631,7 +2631,6 @@ class TestUserLogout(ApiTestCaseMixin): | ||||
|             app, user_1.email | ||||
|         ) | ||||
|         with freeze_time(now + timedelta(seconds=4)): | ||||
|  | ||||
|             response = client.post( | ||||
|                 '/api/auth/logout', | ||||
|                 headers=dict(Authorization=f'Bearer {auth_token}'), | ||||
|   | ||||
| @@ -438,7 +438,6 @@ class TestDecodeUserToken: | ||||
|  | ||||
|     def test_it_raises_error_when_token_is_invalid(self, app: Flask) -> None: | ||||
|         with pytest.raises(jwt.exceptions.DecodeError): | ||||
|  | ||||
|             decode_user_token(random_string()) | ||||
|  | ||||
|     def test_it_raises_error_when_token_body_is_invalid( | ||||
| @@ -451,7 +450,6 @@ class TestDecodeUserToken: | ||||
|             jwt.exceptions.InvalidSignatureError, | ||||
|             match='Signature verification failed', | ||||
|         ): | ||||
|  | ||||
|             decode_user_token(modified_token) | ||||
|  | ||||
|     def test_it_raises_error_when_secret_key_is_invalid( | ||||
| @@ -471,7 +469,6 @@ class TestDecodeUserToken: | ||||
|             jwt.exceptions.InvalidSignatureError, | ||||
|             match='Signature verification failed', | ||||
|         ): | ||||
|  | ||||
|             decode_user_token(token) | ||||
|  | ||||
|     def test_it_raises_error_when_algorithm_is_not_hs256( | ||||
| @@ -494,7 +491,6 @@ class TestDecodeUserToken: | ||||
|             algorithm="RS256", | ||||
|         ) | ||||
|         with pytest.raises(jwt.exceptions.InvalidAlgorithmError): | ||||
|  | ||||
|             decode_user_token(token) | ||||
|  | ||||
|     def test_it_raises_error_when_token_is_expired(self, app: Flask) -> None: | ||||
| @@ -503,7 +499,6 @@ class TestDecodeUserToken: | ||||
|         with pytest.raises( | ||||
|             jwt.exceptions.ExpiredSignatureError, match='Signature has expired' | ||||
|         ): | ||||
|  | ||||
|             decode_user_token(token) | ||||
|  | ||||
|     def test_it_returns_user_id(self, app: Flask) -> None: | ||||
|   | ||||
| @@ -335,7 +335,6 @@ class TestGetStatsByTime(ApiTestCaseMixin): | ||||
|         seven_workouts_user_1: Workout, | ||||
|         workout_running_user_1: Workout, | ||||
|     ) -> None: | ||||
|  | ||||
|         client, auth_token = self.get_test_client_and_auth_token( | ||||
|             app, user_1_paris.email | ||||
|         ) | ||||
|   | ||||
| @@ -46,7 +46,6 @@ class TestStoppedSpeedThreshold: | ||||
|             'gpxpy.gpx.GPXTrackSegment.get_moving_data', | ||||
|             return_value=moving_data, | ||||
|         ) as gpx_track_segment_mock: | ||||
|  | ||||
|             process_files( | ||||
|                 auth_user=user_1, | ||||
|                 folders=folders, | ||||
| @@ -81,7 +80,6 @@ class TestStoppedSpeedThreshold: | ||||
|             'gpxpy.gpx.GPXTrackSegment.get_moving_data', | ||||
|             return_value=moving_data, | ||||
|         ) as gpx_track_segment_mock: | ||||
|  | ||||
|             process_files( | ||||
|                 auth_user=user_1, | ||||
|                 folders=folders, | ||||
| @@ -109,7 +107,6 @@ class TestGetGpxInfoStopTime: | ||||
|         in segments | ||||
|         """ | ||||
|         with patch('builtins.open', return_value=gpx_file): | ||||
|  | ||||
|             gpx_data, _, _ = get_gpx_info( | ||||
|                 gpx_file=random_string(), stopped_speed_threshold=0.0 | ||||
|             ) | ||||
| @@ -124,7 +121,6 @@ class TestGetGpxInfoStopTime: | ||||
|         in segments | ||||
|         """ | ||||
|         with patch('builtins.open', return_value=gpx_file_with_3_segments): | ||||
|  | ||||
|             gpx_data, _, _ = get_gpx_info( | ||||
|                 gpx_file=random_string(), stopped_speed_threshold=0.0 | ||||
|             ) | ||||
|   | ||||
| @@ -67,7 +67,6 @@ class TestDarksky(WeatherTestCase): | ||||
|         with patch( | ||||
|             'fittrackee.workouts.utils.weather.dark_sky.forecastio' | ||||
|         ) as forecast_io_mock: | ||||
|  | ||||
|             darksky.get_weather(point) | ||||
|  | ||||
|         forecast_io_mock.load_forecast.assert_called_with( | ||||
| @@ -102,7 +101,6 @@ class TestDarksky(WeatherTestCase): | ||||
|         with patch( | ||||
|             'fittrackee.workouts.utils.weather.dark_sky.forecastio' | ||||
|         ) as forecast_io_mock: | ||||
|  | ||||
|             darksky.get_weather(point) | ||||
|  | ||||
|         forecast_io_mock.load_forecast.assert_called_with( | ||||
| @@ -189,7 +187,6 @@ class TestVisualCrossingGetWeather(WeatherTestCase, CallArgsMixin): | ||||
|         point = self.get_gpx_point(time) | ||||
|         visual_crossing = VisualCrossing(api_key=self.api_key) | ||||
|         with patch.object(requests, 'get') as get_mock: | ||||
|  | ||||
|             visual_crossing.get_weather(point) | ||||
|  | ||||
|         args = self.get_args(get_mock.call_args) | ||||
| @@ -202,7 +199,6 @@ class TestVisualCrossingGetWeather(WeatherTestCase, CallArgsMixin): | ||||
|     def test_it_calls_api_with_expected_params(self) -> None: | ||||
|         visual_crossing = VisualCrossing(api_key=self.api_key) | ||||
|         with patch.object(requests, 'get') as get_mock: | ||||
|  | ||||
|             visual_crossing.get_weather(self.get_gpx_point(datetime.utcnow())) | ||||
|  | ||||
|         kwargs = self.get_kwargs(get_mock.call_args) | ||||
| @@ -232,7 +228,6 @@ class TestVisualCrossingGetWeather(WeatherTestCase, CallArgsMixin): | ||||
|         ) | ||||
|         visual_crossing = VisualCrossing(api_key=self.api_key) | ||||
|         with patch.object(requests, 'get', return_value=self.get_response()): | ||||
|  | ||||
|             weather_data = visual_crossing.get_weather(point) | ||||
|  | ||||
|         current_conditions: Dict = VISUAL_CROSSING_RESPONSE[  # type: ignore | ||||
|   | ||||
		Reference in New Issue
	
	Block a user