diff options
author | Frederick Muriuki Muriithi | 2023-09-14 12:06:23 +0300 |
---|---|---|
committer | Frederick Muriuki Muriithi | 2023-09-26 03:44:30 +0300 |
commit | e19b01571ce61e01f482a1dadeeb2fd835fda939 (patch) | |
tree | 27b8c7f86313a86bc1e6705ac65ff5996403eace /tests/unit | |
parent | 345e33fc8e1b12dda6626307ebac7e1206200974 (diff) | |
download | gn-auth-e19b01571ce61e01f482a1dadeeb2fd835fda939.tar.gz |
Move `groups` package under `resources` package
With user groups being resources that users can act on (with the
recent changes), this commit moves the `groups` module to under the
`resources` module.
It also renames the `*_resources.py` modules by dropping the
`_resources` part since the code is under the `resources` module
anyway.
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/auth/fixtures/group_fixtures.py | 2 | ||||
-rw-r--r-- | tests/unit/auth/test_groups.py | 12 | ||||
-rw-r--r-- | tests/unit/auth/test_resources.py | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/tests/unit/auth/fixtures/group_fixtures.py b/tests/unit/auth/fixtures/group_fixtures.py index 8a4e79b..66edf5e 100644 --- a/tests/unit/auth/fixtures/group_fixtures.py +++ b/tests/unit/auth/fixtures/group_fixtures.py @@ -4,7 +4,7 @@ import uuid import pytest from gn_auth.auth.db import sqlite3 as db -from gn_auth.auth.authorisation.groups import Group, GroupRole +from gn_auth.auth.authorisation.resources.groups import Group, GroupRole from gn_auth.auth.authorisation.resources import Resource, ResourceCategory from .role_fixtures import RESOURCE_EDITOR_ROLE, RESOURCE_READER_ROLE diff --git a/tests/unit/auth/test_groups.py b/tests/unit/auth/test_groups.py index 9c4e760..a6a0da5 100644 --- a/tests/unit/auth/test_groups.py +++ b/tests/unit/auth/test_groups.py @@ -9,7 +9,7 @@ from gn_auth.auth.authentication.users import User from gn_auth.auth.authorisation.roles import Role from gn_auth.auth.authorisation.privileges import Privilege from gn_auth.auth.authorisation.errors import AuthorisationError -from gn_auth.auth.authorisation.groups.models import ( +from gn_auth.auth.authorisation.resources.groups.models import ( Group, GroupRole, user_group, create_group, create_group_role) from tests.unit.auth import conftest @@ -43,7 +43,7 @@ def test_create_group(# pylint: disable=[too-many-arguments] THEN: verify they are only able to create the group if they have the appropriate privileges """ - mocker.patch("gn_auth.auth.authorisation.groups.models.uuid4", conftest.uuid_fn) + mocker.patch("gn_auth.auth.authorisation.resources.groups.models.uuid4", conftest.uuid_fn) mocker.patch("gn_auth.auth.authorisation.checks.require_oauth.acquire", conftest.get_tokeniser(user)) with db.connection(auth_testdb_path) as conn: @@ -59,7 +59,7 @@ def test_create_group_raises_exception_with_non_privileged_user(# pylint: disabl WHEN: the user attempts to create a group THEN: verify the system raises an exception """ - mocker.patch("gn_auth.auth.authorisation.groups.models.uuid4", conftest.uuid_fn) + mocker.patch("gn_auth.auth.authorisation.resources.groups.models.uuid4", conftest.uuid_fn) mocker.patch("gn_auth.auth.authorisation.checks.require_oauth.acquire", conftest.get_tokeniser(user)) with db.connection(auth_testdb_path) as conn: @@ -86,7 +86,7 @@ def test_create_group_role(mocker, fxtr_users_in_group, user, expected): THEN: verify they are only able to create the role if they have the appropriate privileges and that the role is attached to the given group """ - mocker.patch("gn_auth.auth.authorisation.groups.models.uuid4", conftest.uuid_fn) + mocker.patch("gn_auth.auth.authorisation.resources.groups.models.uuid4", conftest.uuid_fn) mocker.patch("gn_auth.auth.authorisation.roles.models.uuid4", conftest.uuid_fn) mocker.patch("gn_auth.auth.authorisation.checks.require_oauth.acquire", conftest.get_tokeniser(user)) @@ -112,7 +112,7 @@ def test_create_group_role_raises_exception_with_unauthorised_users( THEN: verify they are only able to create the role if they have the appropriate privileges and that the role is attached to the given group """ - mocker.patch("gn_auth.auth.authorisation.groups.models.uuid4", conftest.uuid_fn) + mocker.patch("gn_auth.auth.authorisation.resources.groups.models.uuid4", conftest.uuid_fn) mocker.patch("gn_auth.auth.authorisation.roles.models.uuid4", conftest.uuid_fn) mocker.patch("gn_auth.auth.authorisation.checks.require_oauth.acquire", conftest.get_tokeniser(user)) @@ -130,7 +130,7 @@ def test_create_multiple_groups(mocker, fxtr_users): THEN: The system should prevent that, and respond with an appropriate error message """ - mocker.patch("gn_auth.auth.authorisation.groups.models.uuid4", conftest.uuid_fn) + mocker.patch("gn_auth.auth.authorisation.resources.groups.models.uuid4", conftest.uuid_fn) user = User( UUID("ecb52977-3004-469e-9428-2a1856725c7f"), "group@lead.er", "Group Leader") diff --git a/tests/unit/auth/test_resources.py b/tests/unit/auth/test_resources.py index 57ccc1d..ee4f312 100644 --- a/tests/unit/auth/test_resources.py +++ b/tests/unit/auth/test_resources.py @@ -5,8 +5,8 @@ import pytest from gn_auth.auth.db import sqlite3 as db -from gn_auth.auth.authorisation.groups import Group from gn_auth.auth.authorisation.errors import AuthorisationError +from gn_auth.auth.authorisation.resources.groups import Group from gn_auth.auth.authorisation.resources.models import ( Resource, user_resources, create_resource, ResourceCategory, public_resources) |