API - OAuth2 scopes tests refacto

This commit is contained in:
Sam
2023-05-21 16:13:14 +02:00
parent 518251d442
commit 230ce9022e
11 changed files with 46 additions and 239 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 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,