diff --git a/conftest.py b/conftest.py index 9b3542cb..fce31e7a 100755 --- a/conftest.py +++ b/conftest.py @@ -12,7 +12,7 @@ from batchrun.models import Command, Job, JobRun, JobRunLog from forms.models import Answer, Choice, Entry, Field, Form, Section -from forms.models.form import EntrySection +from forms.models.form import Attachment, EntrySection from forms.tests.conftest import fake from forms.utils import EmailMessageInput from leasing.enums import ( @@ -40,7 +40,10 @@ from leasing.models.receivable_type import ReceivableType from plotsearch.models import ( AreaSearch, + AreaSearchAttachment, AreaSearchIntendedUse, + Favourite, + InformationCheck, PlotSearch, PlotSearchStage, PlotSearchSubtype, @@ -175,6 +178,18 @@ class Meta: model = AreaSearch +@register +class AreaSearchAttachmentFactory(factory.django.DjangoModelFactory): + class Meta: + model = AreaSearchAttachment + + +@register +class FavouriteFactory(factory.django.DjangoModelFactory): + class Meta: + model = Favourite + + @register class LeaseTypeFactory(factory.django.DjangoModelFactory): identifier = factory.Sequence(lambda n: "A%10d" % n) @@ -504,12 +519,16 @@ class Meta: @register class SectionFactory(factory.django.DjangoModelFactory): + form = factory.SubFactory(FormFactory) + class Meta: model = Section @register class FieldFactory(factory.django.DjangoModelFactory): + section = factory.SubFactory(SectionFactory) + class Meta: model = Field @@ -561,6 +580,15 @@ class Meta: model = Answer +@register +class AttachmentFactory(factory.django.DjangoModelFactory): + + field = factory.SubFactory(FieldFactory) + + class Meta: + model = Attachment + + @pytest.fixture def basic_template_form( form_factory, @@ -1204,6 +1232,14 @@ class Meta: answer = factory.SubFactory(AnswerFactory) +@register +class InformationCheckFactory(factory.django.DjangoModelFactory): + entry_section = factory.SubFactory(EntrySectionFactory) + + class Meta: + model = InformationCheck + + @register class RelatedPlotApplicationFactory(factory.django.DjangoModelFactory): lease = factory.SubFactory(LeaseFactory) diff --git a/plotsearch/models/__init__.py b/plotsearch/models/__init__.py index 08d1abb2..3e782ece 100644 --- a/plotsearch/models/__init__.py +++ b/plotsearch/models/__init__.py @@ -2,6 +2,7 @@ from .plot_search import ( FAQ, AreaSearch, + AreaSearchAttachment, AreaSearchIntendedUse, Favourite, FavouriteTarget, @@ -22,6 +23,7 @@ "Favourite", "FavouriteTarget", "InformationCheck", + "AreaSearchAttachment", "AreaSearchIntendedUse", "PlotSearch", "PlotSearchStage",