aboutsummaryrefslogtreecommitdiffstats
path: root/ctrack/caf
diff options
context:
space:
mode:
Diffstat (limited to 'ctrack/caf')
-rw-r--r--ctrack/caf/migrations/0012_auto_20200226_2202.py17
-rw-r--r--ctrack/caf/models.py4
-rw-r--r--ctrack/caf/tests/factories.py28
3 files changed, 39 insertions, 10 deletions
diff --git a/ctrack/caf/migrations/0012_auto_20200226_2202.py b/ctrack/caf/migrations/0012_auto_20200226_2202.py
new file mode 100644
index 0000000..0dbfd17
--- /dev/null
+++ b/ctrack/caf/migrations/0012_auto_20200226_2202.py
@@ -0,0 +1,17 @@
+# Generated by Django 2.2.9 on 2020-02-26 22:02
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('caf', '0011_auto_20200225_0830'),
+ ]
+
+ operations = [
+ migrations.AlterModelOptions(
+ name='caffilestore',
+ options={},
+ ),
+ ]
diff --git a/ctrack/caf/models.py b/ctrack/caf/models.py
index 820181e..2a9310c 100644
--- a/ctrack/caf/models.py
+++ b/ctrack/caf/models.py
@@ -25,8 +25,8 @@ class CAFFileStore(models.Model):
Organisation, on_delete=models.CASCADE
)
- class Meta:
- verbose_name = "CAF File Store"
+ def __str__(self):
+ return self.descriptor
class DocumentFile(models.Model):
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