aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/organisations/tests
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-10-16 10:22:02 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-10-16 10:22:02 +0100
commit2b11d0e43378c27b250e93e91b9bdc10346af44e (patch)
treedccbd0cd42e2400e3fa5fb363ab9fcd3616f9393 /ctrack/organisations/tests
parent7637504292d8fd183af8f4bcbb968fc1b69cd8f7 (diff)
added basic lead and deputy inspector to organisation model
Diffstat (limited to '')
-rw-r--r--ctrack/organisations/tests/factories.py5
-rw-r--r--ctrack/organisations/tests/test_models.py9
2 files changed, 10 insertions, 4 deletions
diff --git a/ctrack/organisations/tests/factories.py b/ctrack/organisations/tests/factories.py
index 17539f2..c8340b9 100644
--- a/ctrack/organisations/tests/factories.py
+++ b/ctrack/organisations/tests/factories.py
@@ -3,10 +3,11 @@ from datetime import datetime
import factory
from django.contrib.auth import get_user_model
-from factory.django import DjangoModelFactory
from factory import Faker, SubFactory, post_generation
+from factory.django import DjangoModelFactory
from ctrack.organisations.models import Address, Organisation, Person, Role
+from ctrack.users.tests.factories import UserFactory
User = get_user_model()
@@ -43,6 +44,8 @@ class OrganisationFactory(DjangoModelFactory):
oes = factory.LazyFunction(lambda: random.choice([True, False]))
registered_company_name = Faker("company")
registered_company_number = Faker("numerify", text="######")
+ lead_inspector = factory.SubFactory(UserFactory)
+ deputy_lead_inspector = factory.SubFactory(UserFactory)
date_updated = Faker("date_this_year", before_today=True)
comments = Faker("paragraph", nb_sentences=3)
active = True
diff --git a/ctrack/organisations/tests/test_models.py b/ctrack/organisations/tests/test_models.py
index 108d0ce..adb61d9 100644
--- a/ctrack/organisations/tests/test_models.py
+++ b/ctrack/organisations/tests/test_models.py
@@ -1,18 +1,21 @@
import random
import pytest
-
from slugify import slugify
-from ctrack.organisations.models import IncidentReport, Organisation
from ctrack.caf.models import CAF, Grading
-from ctrack.caf.tests.factories import ApplicableSystemFactory
from ctrack.caf.models import EssentialService
+from ctrack.caf.tests.factories import ApplicableSystemFactory
from ctrack.core.utils import fnames
pytestmark = pytest.mark.django_db
+def test_lead_deputy_inspector(org):
+ assert org.lead_inspector
+ assert org.deputy_lead_inspector
+
+
def test_organisation_get_absolute_url(org):
slug = slugify(org.name)
assert org.get_absolute_url() == f"/organisations/{slug}/"