API - lint fix since black upgrade

This commit is contained in:
Sam 2023-02-16 09:39:11 +01:00
parent 4ba560028e
commit 289a2e5f48
9 changed files with 0 additions and 23 deletions

View File

@ -18,7 +18,6 @@ XDIST_WORKER = (
class BaseConfig: class BaseConfig:
DEBUG = False DEBUG = False
TESTING = False TESTING = False
SQLALCHEMY_TRACK_MODIFICATIONS = False SQLALCHEMY_TRACK_MODIFICATIONS = False

View File

@ -90,7 +90,6 @@ class TestEmailServiceUrlParser(CallArgsMixin):
class TestEmailServiceSend(CallArgsMixin): class TestEmailServiceSend(CallArgsMixin):
email_data = { email_data = {
'expiration_delay': '3 seconds', 'expiration_delay': '3 seconds',
'username': 'test', 'username': 'test',
@ -112,7 +111,6 @@ class TestEmailServiceSend(CallArgsMixin):
def test_it_sends_message( def test_it_sends_message(
self, mock_smtp: Mock, mock_smtp_ssl: Mock, app: Flask self, mock_smtp: Mock, mock_smtp_ssl: Mock, app: Flask
) -> None: ) -> None:
email_service.send( email_service.send(
template='password_reset_request', template='password_reset_request',
lang='en', lang='en',
@ -164,7 +162,6 @@ class TestEmailServiceSend(CallArgsMixin):
def test_it_sends_message_without_authentication( def test_it_sends_message_without_authentication(
self, mock_smtp: Mock, mock_smtp_ssl: Mock, app_wo_email_auth: Flask self, mock_smtp: Mock, mock_smtp_ssl: Mock, app_wo_email_auth: Flask
) -> None: ) -> None:
email_service.send( email_service.send(
template='password_reset_request', template='password_reset_request',
lang='en', lang='en',

View File

@ -33,7 +33,6 @@ class TestCreateOAuth2Client:
with patch( with patch(
'fittrackee.oauth2.client.gen_salt', return_value=client_id 'fittrackee.oauth2.client.gen_salt', return_value=client_id
): ):
oauth_client = create_oauth2_client(TEST_METADATA, user_1) oauth_client = create_oauth2_client(TEST_METADATA, user_1)
assert oauth_client.client_id == client_id assert oauth_client.client_id == client_id
@ -157,7 +156,6 @@ class TestCreateOAuth2Client:
with patch( with patch(
'fittrackee.oauth2.client.gen_salt', return_value=client_secret 'fittrackee.oauth2.client.gen_salt', return_value=client_secret
): ):
oauth_client = create_oauth2_client(TEST_METADATA, user_1) oauth_client = create_oauth2_client(TEST_METADATA, user_1)
assert oauth_client.client_secret == client_secret assert oauth_client.client_secret == client_secret

View File

@ -139,7 +139,6 @@ class TestOAuthClientCreation(ApiTestCaseMixin):
'fittrackee.oauth2.client.gen_salt', 'fittrackee.oauth2.client.gen_salt',
side_effect=[client_id, client_secret], side_effect=[client_id, client_secret],
): ):
response = client.post( response = client.post(
self.route, self.route,
data=json.dumps(TEST_OAUTH_CLIENT_METADATA), data=json.dumps(TEST_OAUTH_CLIENT_METADATA),

View File

@ -2631,7 +2631,6 @@ class TestUserLogout(ApiTestCaseMixin):
app, user_1.email app, user_1.email
) )
with freeze_time(now + timedelta(seconds=4)): with freeze_time(now + timedelta(seconds=4)):
response = client.post( response = client.post(
'/api/auth/logout', '/api/auth/logout',
headers=dict(Authorization=f'Bearer {auth_token}'), headers=dict(Authorization=f'Bearer {auth_token}'),

View File

@ -438,7 +438,6 @@ class TestDecodeUserToken:
def test_it_raises_error_when_token_is_invalid(self, app: Flask) -> None: def test_it_raises_error_when_token_is_invalid(self, app: Flask) -> None:
with pytest.raises(jwt.exceptions.DecodeError): with pytest.raises(jwt.exceptions.DecodeError):
decode_user_token(random_string()) decode_user_token(random_string())
def test_it_raises_error_when_token_body_is_invalid( def test_it_raises_error_when_token_body_is_invalid(
@ -451,7 +450,6 @@ class TestDecodeUserToken:
jwt.exceptions.InvalidSignatureError, jwt.exceptions.InvalidSignatureError,
match='Signature verification failed', match='Signature verification failed',
): ):
decode_user_token(modified_token) decode_user_token(modified_token)
def test_it_raises_error_when_secret_key_is_invalid( def test_it_raises_error_when_secret_key_is_invalid(
@ -471,7 +469,6 @@ class TestDecodeUserToken:
jwt.exceptions.InvalidSignatureError, jwt.exceptions.InvalidSignatureError,
match='Signature verification failed', match='Signature verification failed',
): ):
decode_user_token(token) decode_user_token(token)
def test_it_raises_error_when_algorithm_is_not_hs256( def test_it_raises_error_when_algorithm_is_not_hs256(
@ -494,7 +491,6 @@ class TestDecodeUserToken:
algorithm="RS256", algorithm="RS256",
) )
with pytest.raises(jwt.exceptions.InvalidAlgorithmError): with pytest.raises(jwt.exceptions.InvalidAlgorithmError):
decode_user_token(token) decode_user_token(token)
def test_it_raises_error_when_token_is_expired(self, app: Flask) -> None: def test_it_raises_error_when_token_is_expired(self, app: Flask) -> None:
@ -503,7 +499,6 @@ class TestDecodeUserToken:
with pytest.raises( with pytest.raises(
jwt.exceptions.ExpiredSignatureError, match='Signature has expired' jwt.exceptions.ExpiredSignatureError, match='Signature has expired'
): ):
decode_user_token(token) decode_user_token(token)
def test_it_returns_user_id(self, app: Flask) -> None: def test_it_returns_user_id(self, app: Flask) -> None:

View File

@ -335,7 +335,6 @@ class TestGetStatsByTime(ApiTestCaseMixin):
seven_workouts_user_1: Workout, seven_workouts_user_1: Workout,
workout_running_user_1: Workout, workout_running_user_1: Workout,
) -> None: ) -> None:
client, auth_token = self.get_test_client_and_auth_token( client, auth_token = self.get_test_client_and_auth_token(
app, user_1_paris.email app, user_1_paris.email
) )

View File

@ -46,7 +46,6 @@ class TestStoppedSpeedThreshold:
'gpxpy.gpx.GPXTrackSegment.get_moving_data', 'gpxpy.gpx.GPXTrackSegment.get_moving_data',
return_value=moving_data, return_value=moving_data,
) as gpx_track_segment_mock: ) as gpx_track_segment_mock:
process_files( process_files(
auth_user=user_1, auth_user=user_1,
folders=folders, folders=folders,
@ -81,7 +80,6 @@ class TestStoppedSpeedThreshold:
'gpxpy.gpx.GPXTrackSegment.get_moving_data', 'gpxpy.gpx.GPXTrackSegment.get_moving_data',
return_value=moving_data, return_value=moving_data,
) as gpx_track_segment_mock: ) as gpx_track_segment_mock:
process_files( process_files(
auth_user=user_1, auth_user=user_1,
folders=folders, folders=folders,
@ -109,7 +107,6 @@ class TestGetGpxInfoStopTime:
in segments in segments
""" """
with patch('builtins.open', return_value=gpx_file): with patch('builtins.open', return_value=gpx_file):
gpx_data, _, _ = get_gpx_info( gpx_data, _, _ = get_gpx_info(
gpx_file=random_string(), stopped_speed_threshold=0.0 gpx_file=random_string(), stopped_speed_threshold=0.0
) )
@ -124,7 +121,6 @@ class TestGetGpxInfoStopTime:
in segments in segments
""" """
with patch('builtins.open', return_value=gpx_file_with_3_segments): with patch('builtins.open', return_value=gpx_file_with_3_segments):
gpx_data, _, _ = get_gpx_info( gpx_data, _, _ = get_gpx_info(
gpx_file=random_string(), stopped_speed_threshold=0.0 gpx_file=random_string(), stopped_speed_threshold=0.0
) )

View File

@ -67,7 +67,6 @@ class TestDarksky(WeatherTestCase):
with patch( with patch(
'fittrackee.workouts.utils.weather.dark_sky.forecastio' 'fittrackee.workouts.utils.weather.dark_sky.forecastio'
) as forecast_io_mock: ) as forecast_io_mock:
darksky.get_weather(point) darksky.get_weather(point)
forecast_io_mock.load_forecast.assert_called_with( forecast_io_mock.load_forecast.assert_called_with(
@ -102,7 +101,6 @@ class TestDarksky(WeatherTestCase):
with patch( with patch(
'fittrackee.workouts.utils.weather.dark_sky.forecastio' 'fittrackee.workouts.utils.weather.dark_sky.forecastio'
) as forecast_io_mock: ) as forecast_io_mock:
darksky.get_weather(point) darksky.get_weather(point)
forecast_io_mock.load_forecast.assert_called_with( forecast_io_mock.load_forecast.assert_called_with(
@ -189,7 +187,6 @@ class TestVisualCrossingGetWeather(WeatherTestCase, CallArgsMixin):
point = self.get_gpx_point(time) point = self.get_gpx_point(time)
visual_crossing = VisualCrossing(api_key=self.api_key) visual_crossing = VisualCrossing(api_key=self.api_key)
with patch.object(requests, 'get') as get_mock: with patch.object(requests, 'get') as get_mock:
visual_crossing.get_weather(point) visual_crossing.get_weather(point)
args = self.get_args(get_mock.call_args) 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: def test_it_calls_api_with_expected_params(self) -> None:
visual_crossing = VisualCrossing(api_key=self.api_key) visual_crossing = VisualCrossing(api_key=self.api_key)
with patch.object(requests, 'get') as get_mock: with patch.object(requests, 'get') as get_mock:
visual_crossing.get_weather(self.get_gpx_point(datetime.utcnow())) visual_crossing.get_weather(self.get_gpx_point(datetime.utcnow()))
kwargs = self.get_kwargs(get_mock.call_args) kwargs = self.get_kwargs(get_mock.call_args)
@ -232,7 +228,6 @@ class TestVisualCrossingGetWeather(WeatherTestCase, CallArgsMixin):
) )
visual_crossing = VisualCrossing(api_key=self.api_key) visual_crossing = VisualCrossing(api_key=self.api_key)
with patch.object(requests, 'get', return_value=self.get_response()): with patch.object(requests, 'get', return_value=self.get_response()):
weather_data = visual_crossing.get_weather(point) weather_data = visual_crossing.get_weather(point)
current_conditions: Dict = VISUAL_CROSSING_RESPONSE[ # type: ignore current_conditions: Dict = VISUAL_CROSSING_RESPONSE[ # type: ignore