aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack
diff options
context:
space:
mode:
Diffstat (limited to 'ctrack')
-rw-r--r--ctrack/conftest.py18
-rw-r--r--ctrack/organisations/tests/test_views.py6
2 files changed, 15 insertions, 9 deletions
diff --git a/ctrack/conftest.py b/ctrack/conftest.py
index 753335f..bca55ef 100644
--- a/ctrack/conftest.py
+++ b/ctrack/conftest.py
@@ -26,6 +26,18 @@ from ctrack.users.tests.factories import UserFactory
@pytest.fixture
+def submode():
+ return Submode.objects.create(
+ descriptor="Light Rail", mode=Mode.objects.create(descriptor="Rail")
+ )
+
+
+@pytest.fixture
+def mode():
+ return Mode.objects.create(descriptor="Rail")
+
+
+@pytest.fixture
def role():
return RoleFactory.create(name="Test Role")
@@ -95,11 +107,9 @@ def user() -> User:
@pytest.fixture
-def person(user):
+def person(user, submode, org_with_people):
+ org = org_with_people
role = RoleFactory.create(name="Compliance Inspector")
- mode = Mode.objects.create(descriptor="Rail")
- submode = Submode.objects.create(descriptor="Light Rail", mode=mode)
- org = OrganisationFactory.create(submode=submode)
person = PersonFactory.create(
first_name="Toss",
last_name="McBride",
diff --git a/ctrack/organisations/tests/test_views.py b/ctrack/organisations/tests/test_views.py
index 3b8f938..85ccc5a 100644
--- a/ctrack/organisations/tests/test_views.py
+++ b/ctrack/organisations/tests/test_views.py
@@ -67,12 +67,8 @@ def test_incident_report_create_view(stakeholder_user):
def test_only_member_of_cct_user_group_can_view_a_single_person(
- stakeholder_user, org_with_people, client
+ stakeholder_user, org_with_people, client, role, submode
):
- role = RoleFactory.create()
- submode = Submode.objects.create(
- descriptor="Light Rail", mode=Mode.objects.create(descriptor="Rail")
- )
PersonFactory.create(
role=role,
predecessor=None,