aboutsummaryrefslogtreecommitdiff
path: root/tests/unit/auth/test_groups.py
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-02-02 11:35:51 +0300
committerFrederick Muriuki Muriithi2023-02-02 12:03:51 +0300
commitdfe5eb18e3ec8dc570d118bfe95c5d4dcb2c7575 (patch)
treeb45da1e9eba405042ef47174215b827739f5a393 /tests/unit/auth/test_groups.py
parent6fc120aca6062f96725adaece85a7b76000affda (diff)
downloadgenenetwork3-dfe5eb18e3ec8dc570d118bfe95c5d4dcb2c7575.tar.gz
auth: Reorganise modules/packages for easier dev and maintenance
Split the views/routes into separate modules each dealing with a narrower scope of the application to aid in maintenance, and help with making the development easier.
Diffstat (limited to 'tests/unit/auth/test_groups.py')
-rw-r--r--tests/unit/auth/test_groups.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/unit/auth/test_groups.py b/tests/unit/auth/test_groups.py
index 219b82a..18f9b23 100644
--- a/tests/unit/auth/test_groups.py
+++ b/tests/unit/auth/test_groups.py
@@ -9,7 +9,7 @@ from gn3.auth.authentication.users import User
from gn3.auth.authorisation.roles import Role
from gn3.auth.authorisation.privileges import Privilege
from gn3.auth.authorisation.errors import AuthorisationError
-from gn3.auth.authorisation.groups import (
+from gn3.auth.authorisation.groups.models import (
Group, GroupRole, user_group, create_group, MembershipError,
create_group_role)
@@ -46,7 +46,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("gn3.auth.authorisation.groups.uuid4", uuid_fn)
+ mocker.patch("gn3.auth.authorisation.groups.models.uuid4", uuid_fn)
with fxtr_app.app_context() as flask_context:
flask_context.g.user = user
with db.connection(auth_testdb_path) as conn:
@@ -62,7 +62,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("gn3.auth.authorisation.groups.uuid4", uuid_fn)
+ mocker.patch("gn3.auth.authorisation.groups.models.uuid4", uuid_fn)
with fxtr_app.app_context() as flask_context:
flask_context.g.user = user
with db.connection(auth_testdb_path) as conn:
@@ -89,8 +89,8 @@ def test_create_group_role(mocker, fxtr_users_in_group, fxtr_app, 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("gn3.auth.authorisation.groups.uuid4", uuid_fn)
- mocker.patch("gn3.auth.authorisation.roles.uuid4", uuid_fn)
+ mocker.patch("gn3.auth.authorisation.groups.models.uuid4", uuid_fn)
+ mocker.patch("gn3.auth.authorisation.roles.models.uuid4", uuid_fn)
conn, _group, _users = fxtr_users_in_group
with fxtr_app.app_context() as flask_context, db.cursor(conn) as cursor:
flask_context.g.user = user
@@ -114,8 +114,8 @@ 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("gn3.auth.authorisation.groups.uuid4", uuid_fn)
- mocker.patch("gn3.auth.authorisation.roles.uuid4", uuid_fn)
+ mocker.patch("gn3.auth.authorisation.groups.models.uuid4", uuid_fn)
+ mocker.patch("gn3.auth.authorisation.roles.models.uuid4", uuid_fn)
conn, _group, _users = fxtr_users_in_group
with fxtr_app.app_context() as flask_context:
flask_context.g.user = user
@@ -132,7 +132,7 @@ def test_create_multiple_groups(mocker, fxtr_app, fxtr_users):
THEN: The system should prevent that, and respond with an appropriate error
message
"""
- mocker.patch("gn3.auth.authorisation.groups.uuid4", uuid_fn)
+ mocker.patch("gn3.auth.authorisation.groups.models.uuid4", uuid_fn)
user = User(
UUID("ecb52977-3004-469e-9428-2a1856725c7f"), "group@lead.er",
"Group Leader")