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

@ -19,7 +19,7 @@ from fittrackee.users.utils.token import get_user_token
from fittrackee.workouts.models import Sport
from ..mixins import ApiTestCaseMixin
from ..utils import jsonify_dict
from ..utils import OAUTH_SCOPES, jsonify_dict
USER_AGENT = (
'Mozilla/5.0 (X11; Linux x86_64; rv:98.0) Gecko/20100101 Firefox/98.0'
@ -622,15 +622,7 @@ class TestUserProfile(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', True),
('profile:write', False),
('users:read', False),
('users:write', False),
('workouts:read', False),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'profile:read': True}.items(),
)
def test_expected_scopes_are_defined(
self, app: Flask, user_1: User, client_scope: str, can_access: bool
@ -719,15 +711,7 @@ class TestUserProfileUpdate(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', True),
('users:read', False),
('users:write', False),
('workouts:read', False),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'profile:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -1389,15 +1373,7 @@ class TestUserAccountUpdate(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', True),
('users:read', False),
('users:write', False),
('workouts:read', False),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'profile:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -1505,15 +1481,7 @@ class TestUserPreferencesUpdate(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', True),
('users:read', False),
('users:write', False),
('workouts:read', False),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'profile:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -1723,15 +1691,7 @@ class TestUserSportPreferencesUpdate(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', True),
('users:read', False),
('users:write', False),
('workouts:read', False),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'profile:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -1814,15 +1774,7 @@ class TestUserSportPreferencesReset(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', True),
('users:read', False),
('users:write', False),
('workouts:read', False),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'profile:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -1981,15 +1933,7 @@ class TestUserPicture(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', True),
('users:read', False),
('users:write', False),
('workouts:read', False),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'profile:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,

View File

@ -12,7 +12,7 @@ from fittrackee.utils import get_readable_duration
from fittrackee.workouts.models import Sport, Workout
from ..mixins import ApiTestCaseMixin
from ..utils import jsonify_dict
from ..utils import OAUTH_SCOPES, jsonify_dict
class TestGetUser(ApiTestCaseMixin):
@ -135,15 +135,7 @@ class TestGetUser(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', True),
('users:write', False),
('workouts:read', False),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'users:read': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -925,15 +917,7 @@ class TestGetUsers(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', True),
('users:write', False),
('workouts:read', False),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'users:read': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -1436,15 +1420,7 @@ class TestUpdateUser(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', True),
('workouts:read', False),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'users:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,
@ -1713,15 +1689,7 @@ class TestDeleteUser(ApiTestCaseMixin):
@pytest.mark.parametrize(
'client_scope, can_access',
[
('application:write', False),
('profile:read', False),
('profile:write', False),
('users:read', False),
('users:write', True),
('workouts:read', False),
('workouts:write', False),
],
{**OAUTH_SCOPES, 'users:write': True}.items(),
)
def test_expected_scopes_are_defined(
self,