aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/resources/factories.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyblackbird_cc/resources/factories.py')
-rw-r--r--pyblackbird_cc/resources/factories.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/pyblackbird_cc/resources/factories.py b/pyblackbird_cc/resources/factories.py
new file mode 100644
index 0000000..b78822d
--- /dev/null
+++ b/pyblackbird_cc/resources/factories.py
@@ -0,0 +1,31 @@
+import factory
+
+
+class ResourceTypeModelFactory(factory.django.DjangoModelFactory):
+ class Meta:
+ model = "resources.ResourceType"
+ django_get_or_create = ("name",)
+
+ name = factory.Sequence(lambda n: f"Default Resource Type {n}")
+
+
+class ResourceCategoryModelFactory(factory.django.DjangoModelFactory):
+ class Meta:
+ model = "resources.ResourceCategory"
+ django_get_or_create = ("name",)
+
+ name = factory.Sequence(lambda n: f"Default Resource Category {n}")
+
+
+class ResourceModelFactory(factory.django.DjangoModelFactory):
+ class Meta:
+ model = "resources.Resource"
+
+ name = factory.Sequence(lambda n: f"Default Resource {n}")
+ thumbnail_filenames = factory.Sequence(lambda n: [f"thumbnail_{n}.jpg"])
+ resource_type = factory.SubFactory(ResourceTypeModelFactory)
+ main_resource_category = factory.SubFactory(ResourceCategoryModelFactory)
+ additional_resource_category = factory.SubFactory(ResourceCategoryModelFactory)
+ description = factory.Sequence(lambda n: f"Default description {n}")
+ age_range = factory.Iterator(["5-7", "7-10", "10+"])
+ curriculum = factory.Iterator(["English", "Scottish"])