mirror of
https://github.com/Hopiu/wagtail-modeltranslation.git
synced 2026-03-16 22:10:30 +00:00
Update tests to work on wt2
This commit is contained in:
parent
7cc4eece20
commit
cf2bcc5a7f
2 changed files with 41 additions and 12 deletions
43
runtests.py
43
runtests.py
|
|
@ -31,14 +31,9 @@ def runtests():
|
|||
})
|
||||
|
||||
# Configure test environment
|
||||
settings.configure(
|
||||
DATABASES=DATABASES,
|
||||
INSTALLED_APPS=(
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.auth',
|
||||
'taggit',
|
||||
'rest_framework',
|
||||
|
||||
import wagtail
|
||||
if wagtail.VERSION[0] < 2:
|
||||
WAGTAIL_MODULES = [
|
||||
'wagtail.wagtailcore',
|
||||
'wagtail.wagtailadmin',
|
||||
'wagtail.wagtaildocs',
|
||||
|
|
@ -52,13 +47,41 @@ def runtests():
|
|||
'wagtail.wagtailsites',
|
||||
'wagtail.contrib.settings',
|
||||
'wagtail.contrib.wagtailapi',
|
||||
]
|
||||
WAGTAIL_CORE = 'wagtail.wagtailcore'
|
||||
else:
|
||||
WAGTAIL_MODULES = [
|
||||
'wagtail.core',
|
||||
'wagtail.admin',
|
||||
'wagtail.documents',
|
||||
'wagtail.snippets',
|
||||
'wagtail.users',
|
||||
'wagtail.images',
|
||||
'wagtail.embeds',
|
||||
'wagtail.search',
|
||||
'wagtail.contrib.redirects',
|
||||
'wagtail.contrib.forms',
|
||||
'wagtail.sites',
|
||||
'wagtail.contrib.settings',
|
||||
'wagtail.api'
|
||||
]
|
||||
WAGTAIL_CORE = 'wagtail.core'
|
||||
|
||||
|
||||
settings.configure(
|
||||
DATABASES=DATABASES,
|
||||
INSTALLED_APPS=[
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.auth',
|
||||
'taggit',
|
||||
'rest_framework'] +
|
||||
WAGTAIL_MODULES + [
|
||||
'wagtail_modeltranslation.makemigrations',
|
||||
'wagtail_modeltranslation',
|
||||
),
|
||||
],
|
||||
# remove wagtailcore from serialization as translation columns have not been created at this point
|
||||
# (which causes OperationalError: no such column)
|
||||
TEST_NON_SERIALIZED_APPS=['wagtail.wagtailcore'],
|
||||
TEST_NON_SERIALIZED_APPS=[WAGTAIL_CORE],
|
||||
ROOT_URLCONF=None, # tests override urlconf, but it still needs to be defined
|
||||
LANGUAGES=(
|
||||
('en', 'English'),
|
||||
|
|
|
|||
|
|
@ -298,7 +298,10 @@ class WagtailModeltranslationTest(WagtailModeltranslationTestBase):
|
|||
|
||||
page_edit_handler = models.InlinePanelPage.get_edit_handler()
|
||||
|
||||
form = page_edit_handler.get_form_class(models.InlinePanelPage)
|
||||
if VERSION[0] < 2:
|
||||
form = page_edit_handler.get_form_class(models.InlinePanelPage)
|
||||
else:
|
||||
form = page_edit_handler.get_form_class()
|
||||
|
||||
page_base_fields = ['slug_de', 'slug_en', 'seo_title_de', 'seo_title_en', 'search_description_de',
|
||||
'search_description_en', u'show_in_menus', u'go_live_at', u'expire_at']
|
||||
|
|
@ -331,7 +334,10 @@ class WagtailModeltranslationTest(WagtailModeltranslationTestBase):
|
|||
from wagtail.snippets.views.snippets import get_snippet_edit_handler
|
||||
snippet_edit_handler = get_snippet_edit_handler(models.InlinePanelSnippet)
|
||||
|
||||
form = snippet_edit_handler.get_form_class(models.InlinePanelSnippet)
|
||||
if VERSION[0] < 2:
|
||||
form = snippet_edit_handler.get_form_class(models.InlinePanelSnippet)
|
||||
else:
|
||||
form = snippet_edit_handler.get_form_class()
|
||||
|
||||
inline_model_fields = ['field_name_de', 'field_name_en', 'image_chooser_de', 'image_chooser_en',
|
||||
'fieldrow_name_de', 'fieldrow_name_en', 'name_de', 'name_en', 'image_de', 'image_en',
|
||||
|
|
|
|||
Loading…
Reference in a new issue