diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-03-04 20:26:01 +0000 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-03-04 20:26:01 +0000 |
commit | 785f5d8d12a524b557d83621ecf0ab19f881b336 (patch) | |
tree | 0b4e7e0095d34ffb11444657d0511cacbf230cb5 /ctrack/organisations/management/commands/populate_db.py | |
parent | 11834a2580344b90126f3c25b89f18104b3d3ed9 (diff) |
we now create one caf and one applicable service for each organisaton
Diffstat (limited to 'ctrack/organisations/management/commands/populate_db.py')
-rw-r--r-- | ctrack/organisations/management/commands/populate_db.py | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/ctrack/organisations/management/commands/populate_db.py b/ctrack/organisations/management/commands/populate_db.py index 2800e85..217e43a 100644 --- a/ctrack/organisations/management/commands/populate_db.py +++ b/ctrack/organisations/management/commands/populate_db.py @@ -4,13 +4,14 @@ from random import randint, choice from django.core.management import BaseCommand from django.core.management import CommandParser +from ctrack.caf.models import CAF from ctrack.caf.tests.factories import ( GradingFactory, FileStoreFactory, CAFFactory, - EssentialServiceFactory, + ApplicableSystemFactory, ) -from ctrack.organisations.models import AddressType +from ctrack.organisations.models import AddressType, Organisation from ctrack.organisations.models import Mode from ctrack.organisations.models import Submode from ctrack.organisations.tests.factories import AddressFactory @@ -157,29 +158,35 @@ class Command(BaseCommand): # File store fs = FileStoreFactory.create(physical_location_organisation=orgs[1]) - # Some CAF objects - cafs = [ + # Every org gets on CAF for now + for _ in orgs: CAFFactory.create( quality_grading__descriptor=random.choice(q_descriptors), confidence_grading__descriptor=random.choice(c_descriptors), triage_review_date=None, triage_review_inspector=None, ) - for _ in range(35) - ] - es = [ - EssentialServiceFactory.create( + for org in orgs: + # create a CAF for it + caf = CAFFactory.create( + quality_grading__descriptor=random.choice(q_descriptors), + confidence_grading__descriptor=random.choice(c_descriptors), + triage_review_date=None, + triage_review_inspector=None, + ) + # create an ApplicableSystem for it + app_s = ApplicableSystemFactory.create( name=random.choice(fnames), - organisation=random.choice(orgs), - caf=random.choice(cafs), + organisation=org, + caf=caf, ) - for _ in range(35) - ] # CAF submissions - they create EngagementEvents + # Get a random CAF + _caf = CAF.objects.get(pk=1) # we should have one by now ee3 = EngagementEventFactory.create( - type=etf3, user=user, participants=[inspectors[1], p2], related_caf=cafs[1] + type=etf3, user=user, participants=[inspectors[1], p2], related_caf=_caf ) # TODO - adapt this so that it records more than just Persons created |