aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/organisations/tests
diff options
context:
space:
mode:
authorMatthew Lemon <matt@matthewlemon.com>2020-08-26 15:00:09 +0100
committerMatthew Lemon <matt@matthewlemon.com>2020-08-26 15:00:09 +0100
commitbc556144060dcbbf1d89279b9c5f3d54fa271b6b (patch)
tree964615b7dbc2c4010e2814fef6c346547a16d99e /ctrack/organisations/tests
parent6f4ea7ef9018e2e1df396f16aa4080dcee3ef6df (diff)
first passing test - making essential service an object
Diffstat (limited to 'ctrack/organisations/tests')
-rw-r--r--ctrack/organisations/tests/test_models.py28
1 files changed, 25 insertions, 3 deletions
diff --git a/ctrack/organisations/tests/test_models.py b/ctrack/organisations/tests/test_models.py
index 8287e97..09d4f12 100644
--- a/ctrack/organisations/tests/test_models.py
+++ b/ctrack/organisations/tests/test_models.py
@@ -1,8 +1,14 @@
+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.core.utils import fnames
pytestmark = pytest.mark.django_db
@@ -24,6 +30,22 @@ def test_new_address(addr):
assert addr.organisation.name
-def test_essential_service():
- es = EssentialService()
- assert es
+def test_essential_service(org):
+ q1 = Grading.objects.create(descriptor="Q1", description="baws", type="QUALITY")
+ c1 = Grading.objects.create(
+ descriptor="C1", description="baws_c", type="CONFIDENCE"
+ )
+ caf = CAF.objects.create(
+ quality_grading=q1,
+ confidence_grading=c1,
+ triage_review_date=None,
+ triage_review_inspector=None,
+ )
+ ass = ApplicableSystemFactory.create(
+ name=random.choice(fnames), organisation=org, caf=caf,
+ )
+ es = EssentialService.objects.create(
+ name="Test ES", description="Test ES Description", organisation=org
+ )
+ es.systems.add(ass)
+ assert es.systems.first().organisation.name == org.name