From 385486a2b574fcb08f3177062744667f4a256074 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Mon, 29 Jan 2018 16:42:19 +0000
Subject: [PATCH] Move the factories around

---
 opentech/apply/funds/tests/factories/__init__.py          | 2 ++
 opentech/apply/funds/tests/factories/blocks.py            | 8 ++++++++
 .../funds/tests/{factories.py => factories/models.py}     | 3 +++
 opentech/apply/funds/tests/test_models.py                 | 5 +++++
 4 files changed, 18 insertions(+)
 create mode 100644 opentech/apply/funds/tests/factories/__init__.py
 create mode 100644 opentech/apply/funds/tests/factories/blocks.py
 rename opentech/apply/funds/tests/{factories.py => factories/models.py} (97%)

diff --git a/opentech/apply/funds/tests/factories/__init__.py b/opentech/apply/funds/tests/factories/__init__.py
new file mode 100644
index 000000000..65aac859e
--- /dev/null
+++ b/opentech/apply/funds/tests/factories/__init__.py
@@ -0,0 +1,2 @@
+from .models import *
+from .blocks import *
diff --git a/opentech/apply/funds/tests/factories/blocks.py b/opentech/apply/funds/tests/factories/blocks.py
new file mode 100644
index 000000000..d00c748d3
--- /dev/null
+++ b/opentech/apply/funds/tests/factories/blocks.py
@@ -0,0 +1,8 @@
+import wagtail_factories
+
+from opentech.apply.funds.blocks import CustomFormFieldsBlock
+
+
+class CustomFormBlockFactory(wagtail_factories.StructBlockFactory):
+    class Meta:
+        model = CustomFormFieldsBlock
diff --git a/opentech/apply/funds/tests/factories.py b/opentech/apply/funds/tests/factories/models.py
similarity index 97%
rename from opentech/apply/funds/tests/factories.py
rename to opentech/apply/funds/tests/factories/models.py
index aa37d55a8..17880b2ef 100644
--- a/opentech/apply/funds/tests/factories.py
+++ b/opentech/apply/funds/tests/factories/models.py
@@ -7,6 +7,8 @@ import wagtail_factories
 from opentech.apply.funds.models import ApplicationForm, FundType, FundForm, Round
 from opentech.apply.funds.workflow import Action, Phase, Stage, Workflow
 
+from .blocks import CustomFormBlockFactory
+
 
 class ListSubFactory(factory.SubFactory):
     def __init__(self, *args, count=0, **kwargs):
@@ -137,6 +139,7 @@ class ApplicationFormFactory(factory.DjangoModelFactory):
         model = ApplicationForm
 
     name = factory.Faker('word')
+    form_fields = wagtail_factories.StreamFieldFactory({'field': CustomFormBlockFactory})
 
 
 class RoundFactory(wagtail_factories.PageFactory):
diff --git a/opentech/apply/funds/tests/test_models.py b/opentech/apply/funds/tests/test_models.py
index 0c6fcc20c..578572410 100644
--- a/opentech/apply/funds/tests/test_models.py
+++ b/opentech/apply/funds/tests/test_models.py
@@ -124,3 +124,8 @@ class TestRoundModel(TestCase):
 
         with self.assertRaises(ValidationError):
             new_round.clean()
+
+
+class TestFormSubmission(TestCase):
+    def test_can_submit_if_new(self):
+        pass
-- 
GitLab