diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-02-26 22:04:26 +0000 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-02-26 22:04:26 +0000 |
commit | 77572ddf5122947d98a26082d774d6d2c0a74d16 (patch) | |
tree | 45c0b8ecc37dcc8da96da7ac69371af5a2e8d16a /ctrack/caf/tests/factories.py | |
parent | 70a8f6e37a462f2508ed024b2ee34f0df6b16a3b (diff) |
tweaks - added factories for CAFFileStore and DocumentFile
Diffstat (limited to '')
-rw-r--r-- | ctrack/caf/tests/factories.py | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/ctrack/caf/tests/factories.py b/ctrack/caf/tests/factories.py index bae0d9c..ce337f2 100644 --- a/ctrack/caf/tests/factories.py +++ b/ctrack/caf/tests/factories.py @@ -1,9 +1,10 @@ -import factory +import random +import factory from factory import Faker -from ctrack.caf.models import CAF, EssentialService, Grading -from ctrack.organisations.tests.factories import PersonFactory +from ctrack.caf.models import EssentialService, Grading, DocumentFile, FileStore, CAFFileStore +from ctrack.organisations.tests.factories import OrganisationFactory class EssentialServiceFactory(factory.DjangoModelFactory): @@ -22,10 +23,21 @@ class GradingFactory(factory.DjangoModelFactory): model = Grading -class CAFFactory(factory.DjangoModelFactory): - """Factory for CAFs.""" - owner = factory.SubFactory(PersonFactory) -# triage_ranking = factory.SubFactory(TriageRankingFactory) +# TODO: test these two factories +class CAFFileStoreFactory(factory.DjangoModelFactory): + descriptor = "File Store X" + virtual_location = Faker("street_name") + physical_location = random.choice(["Cupboard A", "Tin Box", "The Vault"]) + physical_location_organisation = factory.SubFactory(OrganisationFactory) + + class Meta: + model = CAFFileStore + + +class DocumentFileFactory(factory.DjangoModelFactory): + name = Faker("file_name", extension="xlsx") + type = random.choice([1, 2, 3, 4]) + file_store_location = factory.SubFactory(CAFFileStoreFactory) class Meta: - model = CAF + model = DocumentFile |