Merge branch 'dev' into max_speed_preference

This commit is contained in:
Sam
2023-05-28 14:55:44 +02:00
21 changed files with 57 additions and 249 deletions

View File

@ -7,6 +7,7 @@ from fittrackee.users.models import User
from fittrackee.workouts.models import Sport, Workout
from ..mixins import ApiTestCaseMixin
from ..utils import OAUTH_SCOPES
class TestGetRecords(ApiTestCaseMixin):
@ -901,15 +902,7 @@ class TestGetRecords(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', True),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'workouts:read': True}.items(),
)
def test_expected_scopes_are_defined(
self,

View File

@ -8,7 +8,7 @@ from fittrackee.users.models import User, UserSportPreference
from fittrackee.workouts.models import Sport, Workout
from ..mixins import ApiTestCaseMixin
from ..utils import jsonify_dict
from ..utils import OAUTH_SCOPES, jsonify_dict
class TestGetSports(ApiTestCaseMixin):
@ -141,15 +141,7 @@ class TestGetSports(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', True),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'workouts:read': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -281,15 +273,7 @@ class TestGetSport(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', True),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'workouts:read': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -520,15 +504,7 @@ class TestUpdateSport(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', False),
('workouts:write', True),
],
{**OAUTH_SCOPES, 'workouts:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,

View File

@ -7,6 +7,7 @@ from fittrackee.users.models import User
from fittrackee.workouts.models import Sport, Workout
from ..mixins import ApiTestCaseMixin
from ..utils import OAUTH_SCOPES
class TestGetStatsByTime(ApiTestCaseMixin):
@ -864,15 +865,7 @@ class TestGetStatsByTime(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', True),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'workouts:read': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -1045,15 +1038,7 @@ class TestGetStatsBySport(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', True),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'workouts:read': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -1164,15 +1149,7 @@ class TestGetAllStats(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', True),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'workouts:read': True}.items(),
)
def test_expected_scopes_are_defined(
self,

View File

@ -12,7 +12,7 @@ from fittrackee.users.models import User
from fittrackee.workouts.models import Sport, Workout
from ..mixins import ApiTestCaseMixin
from ..utils import jsonify_dict
from ..utils import OAUTH_SCOPES, jsonify_dict
from .utils import get_random_short_id
@ -106,15 +106,7 @@ class TestGetWorkouts(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', True),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'workouts:read': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -1316,15 +1308,7 @@ class TestGetWorkout(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', True),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'workouts:read': True}.items(),
)
@pytest.mark.parametrize(
'endpoint',
@ -1450,15 +1434,7 @@ class TestDownloadWorkoutGpx(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', True),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'workouts:read': True}.items(),
)
def test_expected_scopes_are_defined(
self,

View File

@ -13,6 +13,7 @@ from fittrackee.users.models import User
from fittrackee.workouts.models import Sport, Workout
from ..mixins import ApiTestCaseMixin, CallArgsMixin
from ..utils import OAUTH_SCOPES
def assert_workout_data_with_gpx(data: Dict) -> None:
@ -970,15 +971,7 @@ class TestPostWorkoutWithGpx(ApiTestCaseMixin, CallArgsMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', False),
('workouts:write', True),
],
{**OAUTH_SCOPES, 'workouts:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -1311,15 +1304,7 @@ class TestPostWorkoutWithoutGpx(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', False),
('workouts:write', True),
],
{**OAUTH_SCOPES, 'workouts:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,

View File

@ -9,6 +9,7 @@ from fittrackee.users.models import User
from fittrackee.workouts.models import Sport, Workout
from ..mixins import ApiTestCaseMixin
from ..utils import OAUTH_SCOPES
from .utils import get_random_short_id, post_a_workout
@ -227,15 +228,7 @@ class TestEditWorkoutWithGpx(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', False),
('workouts:write', True),
],
{**OAUTH_SCOPES, 'workouts:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,

View File

@ -5,6 +5,7 @@ from fittrackee.users.models import User
from fittrackee.workouts.models import Sport, Workout
from ..mixins import ApiTestCaseMixin
from ..utils import OAUTH_SCOPES
from .utils import get_random_short_id, post_a_workout
@ -104,15 +105,7 @@ class TestDeleteWorkoutWithGpx(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', False),
('workouts:write', True),
],
{**OAUTH_SCOPES, 'workouts:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,