diff --git a/opentech/apply/funds/tests/factories/__init__.py b/opentech/apply/funds/tests/factories/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..65aac859ef17c1ab8dcccd23e1d0431758cde1a9 --- /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 0000000000000000000000000000000000000000..d00c748d39f193f67783b7d58fce0ed0536da1ec --- /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 aa37d55a8e2ad6bfe00e33916aa381eedaac16d4..17880b2efb2c1dc78eef7db0c2802dc8b5bfedd7 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 0c6fcc20cfecf8f907c63b447bd295cfab81275c..5785724107486b12567251bb3e2194390416d466 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