8

start using correct model in tests

This commit is contained in:
Paul J Stevens
2017-05-31 13:48:30 +02:00
committed by Michael van Tellingen
parent f693e62bbf
commit 623af1a06a
4 changed files with 36 additions and 8 deletions

25
tests/factories/site.py Normal file
View File

@@ -0,0 +1,25 @@
import factory
from django.utils.text import slugify
from wagtail.wagtailcore.models import Site
from wagtail_factories.factories import MP_NodeFactory
from tests.sandbox.pages.models import HomePage
class PageFactory(MP_NodeFactory):
title = 'Test page'
slug = factory.LazyAttribute(lambda obj: slugify(obj.title))
class Meta:
model = HomePage
class SiteFactory(factory.DjangoModelFactory):
hostname = 'localhost'
port = factory.Sequence(lambda n: 81 + n)
site_name = 'Test site'
root_page = factory.SubFactory(PageFactory, parent=None)
is_default_site = False
class Meta:
model = Site