diff options
Diffstat (limited to '')
-rw-r--r-- | ctrack/organisations/tests/factories.py | 5 | ||||
-rw-r--r-- | ctrack/organisations/tests/test_models.py | 9 |
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}/" |