aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ctrack/assessments/models.py1
-rw-r--r--ctrack/assessments/tests.py3
-rw-r--r--ctrack/assessments/tests/__init__.py0
-rw-r--r--ctrack/assessments/tests/factories.py7
-rw-r--r--ctrack/organisations/management/commands/populate_db.py29
5 files changed, 26 insertions, 14 deletions
diff --git a/ctrack/assessments/models.py b/ctrack/assessments/models.py
index d17ebbd..549416d 100644
--- a/ctrack/assessments/models.py
+++ b/ctrack/assessments/models.py
@@ -28,7 +28,6 @@ class CAFObjective(models.Model):
verbose_name = "CAF Objective"
-
class CAFPrinciple(models.Model):
"""
One of 14 as set out in the framework.
diff --git a/ctrack/assessments/tests.py b/ctrack/assessments/tests.py
deleted file mode 100644
index 7ce503c..0000000
--- a/ctrack/assessments/tests.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from django.test import TestCase
-
-# Create your tests here.
diff --git a/ctrack/assessments/tests/__init__.py b/ctrack/assessments/tests/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/ctrack/assessments/tests/__init__.py
diff --git a/ctrack/assessments/tests/factories.py b/ctrack/assessments/tests/factories.py
new file mode 100644
index 0000000..c8e26ec
--- /dev/null
+++ b/ctrack/assessments/tests/factories.py
@@ -0,0 +1,7 @@
+# Factories for populating the CAF assessment data
+
+import factory
+
+
+# class CAFSelfAssessmentFactory(factory.DjangoModelFactory):
+# caf = factory.SubFactory("ctrack.caf.tests.factories.CAF")
diff --git a/ctrack/organisations/management/commands/populate_db.py b/ctrack/organisations/management/commands/populate_db.py
index 6f51a22..edb070f 100644
--- a/ctrack/organisations/management/commands/populate_db.py
+++ b/ctrack/organisations/management/commands/populate_db.py
@@ -4,6 +4,7 @@ from random import randint, choice
from django.core.management import BaseCommand
from django.core.management import CommandParser
+from ctrack.assessments.models import CAFSelfAssessment
from ctrack.caf.models import CAF
from ctrack.caf.tests.factories import (
GradingFactory,
@@ -11,7 +12,7 @@ from ctrack.caf.tests.factories import (
CAFFactory,
ApplicableSystemFactory,
)
-from ctrack.organisations.models import AddressType, Organisation
+from ctrack.organisations.models import AddressType, Person
from ctrack.organisations.models import Mode
from ctrack.organisations.models import Submode
from ctrack.organisations.tests.factories import AddressFactory
@@ -140,10 +141,12 @@ class Command(BaseCommand):
etf1 = EngagementTypeFactory(descriptor="Information Notice")
etf2 = EngagementTypeFactory(descriptor="Designation Letter")
- etf3 = EngagementTypeFactory(descriptor="CAF - Initial Submission", enforcement_instrument=False)
+ etf3 = EngagementTypeFactory(
+ descriptor="CAF - Initial Submission", enforcement_instrument=False
+ )
- ee1 = EngagementEventFactory.create(type=etf1, user=user, participants=[p1, p2])
- ee2 = EngagementEventFactory.create(type=etf2, user=user, participants=[p3])
+ EngagementEventFactory.create(type=etf1, user=user, participants=[p1, p2])
+ EngagementEventFactory.create(type=etf2, user=user, participants=[p3])
# Quality gradings
q_descriptors = ["Q1", "Q2", "Q3", "Q4", "Q5"]
@@ -156,7 +159,7 @@ class Command(BaseCommand):
GradingFactory.create(descriptor=g, type="CONFIDENCE")
# File store
- fs = FileStoreFactory.create(physical_location_organisation=orgs[1])
+ FileStoreFactory.create(physical_location_organisation=orgs[1])
# Every org gets on CAF for now
for org in orgs:
@@ -166,7 +169,7 @@ class Command(BaseCommand):
# CAF submissions - they create EngagementEvents
# Get a random CAF
_caf = CAF.objects.get(pk=1) # we should have one by now
- ee3 = EngagementEventFactory.create(
+ EngagementEventFactory.create(
type=etf3, user=user, participants=[inspectors[1], p2], related_caf=_caf
)
@@ -185,9 +188,15 @@ class Command(BaseCommand):
triage_review_inspector=None,
)
# Each CAF can have up to three systems associated with it
- for s in range(random.randint(1,3)):
+ for _ in range(random.randint(1, 3)):
ApplicableSystemFactory.create(
- name=random.choice(fnames),
- organisation=org,
- caf=caf,
+ name=random.choice(fnames), organisation=org, caf=caf,
)
+
+ # We want to create a CAF with a bunch of scoring now...
+ _caf2 = CAF.objects.get(pk=2)
+ _completer = Person.objects.get(pk=1)
+ caf_assessment = CAFSelfAssessment(
+ caf=_caf2, completer=_completer, comments="Random Comments"
+ )
+ caf_assessment.save()