dnscms: add more tests

This commit is contained in:
2026-05-19 04:42:27 +02:00
parent f7e0200a0a
commit 843062bb13
6 changed files with 565 additions and 50 deletions
+58
View File
@@ -5,10 +5,35 @@ import pytest
import wagtail_factories
from wagtail.models import Page
from associations.models import AssociationIndex, AssociationPage
from events.models import EventIndex, EventPage
from generic.models import GenericPage
from images.models import CustomImage
from news.models import NewsIndex, NewsPage
from venues.models import VenueIndex, VenuePage
class CustomImageFactory(wagtail_factories.ImageFactory):
class Meta:
model = CustomImage
class AssociationIndexFactory(wagtail_factories.PageFactory):
title = factory.Sequence(lambda n: f"Associations {n}")
lead = "<p>Foreninger og utvalg.</p>"
class Meta:
model = AssociationIndex
class AssociationPageFactory(wagtail_factories.PageFactory):
title = factory.Sequence(lambda n: f"Association {n}")
excerpt = "Et utdrag."
class Meta:
model = AssociationPage
class EventIndexFactory(wagtail_factories.PageFactory):
title = factory.Sequence(lambda n: f"Events {n}")
@@ -23,6 +48,29 @@ class EventPageFactory(wagtail_factories.PageFactory):
model = EventPage
class GenericPageFactory(wagtail_factories.PageFactory):
title = factory.Sequence(lambda n: f"Page {n}")
lead = "<p>Ingress.</p>"
class Meta:
model = GenericPage
class NewsIndexFactory(wagtail_factories.PageFactory):
title = factory.Sequence(lambda n: f"News {n}")
class Meta:
model = NewsIndex
class NewsPageFactory(wagtail_factories.PageFactory):
title = factory.Sequence(lambda n: f"Article {n}")
excerpt = "Et utdrag."
class Meta:
model = NewsPage
class VenueIndexFactory(wagtail_factories.PageFactory):
title = factory.Sequence(lambda n: f"Venues {n}")
@@ -56,6 +104,16 @@ def event_index(home_page):
return EventIndexFactory(parent=home_page)
@pytest.fixture
def news_index(home_page):
return NewsIndexFactory(parent=home_page)
@pytest.fixture
def association_index(home_page):
return AssociationIndexFactory(parent=home_page)
@pytest.fixture
def venue(home_page):
venue_index = VenueIndexFactory(parent=home_page)