kopia lustrzana https://github.com/wagtail/wagtail
Put WagtailTestUtils before TestCase in inheritance MRO
This allows WagtailTestUtils to override the methods in TestCasepull/10060/head
rodzic
b05982e4d2
commit
32bc42b64a
|
@ -3,6 +3,6 @@ from django.test import TestCase
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class AdminAPITestCase(TestCase, WagtailTestUtils):
|
||||
class AdminAPITestCase(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.urls import reverse
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestBulkActionDispatcher(TestCase, WagtailTestUtils):
|
||||
class TestBulkActionDispatcher(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
|
||||
# Login
|
||||
|
|
|
@ -14,7 +14,7 @@ from wagtail.test.testapp.models import SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestBulkDelete(TestCase, WagtailTestUtils):
|
||||
class TestBulkDelete(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
|
|
@ -13,7 +13,7 @@ from wagtail.test.testapp.models import BusinessChild, SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestBulkMove(TestCase, WagtailTestUtils):
|
||||
class TestBulkMove(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -13,7 +13,7 @@ from wagtail.test.testapp.models import SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestBulkPublish(TestCase, WagtailTestUtils):
|
||||
class TestBulkPublish(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
||||
|
@ -222,7 +222,7 @@ class TestBulkPublish(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestBulkPublishIncludingDescendants(TestCase, WagtailTestUtils):
|
||||
class TestBulkPublishIncludingDescendants(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ from wagtail.test.testapp.models import SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestBulkUnpublish(TestCase, WagtailTestUtils):
|
||||
class TestBulkUnpublish(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create pages to unpublish
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
@ -196,7 +196,7 @@ class TestBulkUnpublish(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestBulkUnpublishIncludingDescendants(TestCase, WagtailTestUtils):
|
||||
class TestBulkUnpublishIncludingDescendants(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
|
|
@ -6,7 +6,7 @@ from wagtail.test.testapp.models import EventPage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestContentTypeUse(TestCase, WagtailTestUtils):
|
||||
class TestContentTypeUse(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -7,7 +7,7 @@ from wagtail.test.testapp.models import SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestConvertAlias(TestCase, WagtailTestUtils):
|
||||
class TestConvertAlias(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
|
|
@ -13,7 +13,7 @@ from wagtail.test.testapp.models import (
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestPageCopy(TestCase, WagtailTestUtils):
|
||||
class TestPageCopy(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
|
|
@ -30,7 +30,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
from wagtail.test.utils.timestamps import submittable_timestamp
|
||||
|
||||
|
||||
class TestPageCreation(TestCase, WagtailTestUtils):
|
||||
class TestPageCreation(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
@ -1193,7 +1193,7 @@ class TestPageCreation(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.context["page"].locale, fr_locale)
|
||||
|
||||
|
||||
class TestPermissionedFieldPanels(TestCase, WagtailTestUtils):
|
||||
class TestPermissionedFieldPanels(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1234,7 +1234,7 @@ class TestPermissionedFieldPanels(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, '"secret_data"')
|
||||
|
||||
|
||||
class TestSubpageBusinessRules(TestCase, WagtailTestUtils):
|
||||
class TestSubpageBusinessRules(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
@ -1376,7 +1376,7 @@ class TestSubpageBusinessRules(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestInlinePanelMedia(TestCase, WagtailTestUtils):
|
||||
class TestInlinePanelMedia(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Test that form media required by InlinePanels is correctly pulled in to the edit page
|
||||
"""
|
||||
|
@ -1403,7 +1403,7 @@ class TestInlinePanelMedia(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "wagtailadmin/js/draftail.js")
|
||||
|
||||
|
||||
class TestInlineStreamField(TestCase, WagtailTestUtils):
|
||||
class TestInlineStreamField(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Test that streamfields inside an inline child work
|
||||
"""
|
||||
|
@ -1424,7 +1424,7 @@ class TestInlineStreamField(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, '<div id="sections-__prefix__-body" data-block="')
|
||||
|
||||
|
||||
class TestIssue2994(TestCase, WagtailTestUtils):
|
||||
class TestIssue2994(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
In contrast to most "standard" form fields, StreamField form widgets generally won't
|
||||
provide a postdata field with a name exactly matching the field name. To prevent Django
|
||||
|
@ -1460,7 +1460,7 @@ class TestIssue2994(TestCase, WagtailTestUtils):
|
|||
self.assertEqual("hello world", new_page.body[0].value)
|
||||
|
||||
|
||||
class TestInlinePanelWithTags(TestCase, WagtailTestUtils):
|
||||
class TestInlinePanelWithTags(WagtailTestUtils, TestCase):
|
||||
# https://github.com/wagtail/wagtail/issues/5414#issuecomment-567080707
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1499,7 +1499,7 @@ class TestInlinePanelWithTags(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(new_page.addresses.first().tags.count(), 2)
|
||||
|
||||
|
||||
class TestInlinePanelNonFieldErrors(TestCase, WagtailTestUtils):
|
||||
class TestInlinePanelNonFieldErrors(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Test that non field errors will render for InlinePanels
|
||||
https://github.com/wagtail/wagtail/issues/3890
|
||||
|
@ -1553,7 +1553,7 @@ class TestInlinePanelNonFieldErrors(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAIL_I18N_ENABLED=True)
|
||||
class TestLocaleSelector(TestCase, WagtailTestUtils):
|
||||
class TestLocaleSelector(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1633,7 +1633,7 @@ class TestLocaleSelector(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAIL_I18N_ENABLED=True)
|
||||
class TestLocaleSelectorOnRootPage(TestCase, WagtailTestUtils):
|
||||
class TestLocaleSelectorOnRootPage(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1682,7 +1682,7 @@ class TestLocaleSelectorOnRootPage(TestCase, WagtailTestUtils):
|
|||
self.assertNotContains(response, f'href="{add_translation_url}"')
|
||||
|
||||
|
||||
class TestPageSubscriptionSettings(TestCase, WagtailTestUtils):
|
||||
class TestPageSubscriptionSettings(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
|
|
@ -8,7 +8,7 @@ from wagtail.test.testapp.models import SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestRecentEditsPanel(TestCase, WagtailTestUtils):
|
||||
class TestRecentEditsPanel(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
@ -116,7 +116,7 @@ class TestRecentEditsPanel(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(ctx["last_edits"][0][1], page)
|
||||
|
||||
|
||||
class TestRecentEditsQueryCount(TestCase, WagtailTestUtils):
|
||||
class TestRecentEditsQueryCount(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -12,7 +12,7 @@ from wagtail.test.testapp.models import SimplePage, StandardChild, StandardIndex
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestPageDelete(TestCase, WagtailTestUtils):
|
||||
class TestPageDelete(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
|
|
@ -46,7 +46,7 @@ from wagtail.test.utils.timestamps import rendered_timestamp, submittable_timest
|
|||
from wagtail.users.models import UserProfile
|
||||
|
||||
|
||||
class TestPageEdit(TestCase, WagtailTestUtils):
|
||||
class TestPageEdit(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
@ -1757,7 +1757,7 @@ class TestPageEdit(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestPageEditReordering(TestCase, WagtailTestUtils):
|
||||
class TestPageEditReordering(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
@ -1879,7 +1879,7 @@ class TestPageEditReordering(TestCase, WagtailTestUtils):
|
|||
self.check_order(response, ["abcdefg", "1234567", "7654321"])
|
||||
|
||||
|
||||
class TestIssue197(TestCase, WagtailTestUtils):
|
||||
class TestIssue197(WagtailTestUtils, TestCase):
|
||||
def test_issue_197(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
@ -1918,7 +1918,7 @@ class TestIssue197(TestCase, WagtailTestUtils):
|
|||
self.assertIn("world", page.tags.slugs())
|
||||
|
||||
|
||||
class TestChildRelationsOnSuperclass(TestCase, WagtailTestUtils):
|
||||
class TestChildRelationsOnSuperclass(WagtailTestUtils, TestCase):
|
||||
# In our test models we define AdvertPlacement as a child relation on the Page model.
|
||||
# Here we check that this behaves correctly when exposed on the edit form of a Page
|
||||
# subclass (StandardIndex here).
|
||||
|
@ -2082,7 +2082,7 @@ class TestChildRelationsOnSuperclass(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "alwaysDirty: true")
|
||||
|
||||
|
||||
class TestIssue2492(TestCase, WagtailTestUtils):
|
||||
class TestIssue2492(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
The publication submission message generation was performed using
|
||||
the Page class, as opposed to the specific_class for that Page.
|
||||
|
@ -2146,7 +2146,7 @@ class TestIssue2492(TestCase, WagtailTestUtils):
|
|||
break
|
||||
|
||||
|
||||
class TestIssue3982(TestCase, WagtailTestUtils):
|
||||
class TestIssue3982(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Pages that are not associated with a site, and thus do not have a live URL,
|
||||
should not display a "View live" link in the flash message after being
|
||||
|
@ -2305,7 +2305,7 @@ class TestIssue3982(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestParentalM2M(TestCase, WagtailTestUtils):
|
||||
class TestParentalM2M(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -2483,7 +2483,7 @@ class TestParentalM2M(TestCase, WagtailTestUtils):
|
|||
self.assertIn(self.men_with_beards_category, updated_page.categories.all())
|
||||
|
||||
|
||||
class TestValidationErrorMessages(TestCase, WagtailTestUtils):
|
||||
class TestValidationErrorMessages(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -2622,7 +2622,7 @@ class TestValidationErrorMessages(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestNestedInlinePanel(TestCase, WagtailTestUtils):
|
||||
class TestNestedInlinePanel(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -2726,7 +2726,7 @@ class TestNestedInlinePanel(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAIL_I18N_ENABLED=True)
|
||||
class TestLocaleSelector(TestCase, WagtailTestUtils):
|
||||
class TestLocaleSelector(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -2793,7 +2793,7 @@ class TestLocaleSelector(TestCase, WagtailTestUtils):
|
|||
self.assertNotContains(response, f'href="{edit_translation_url}"')
|
||||
|
||||
|
||||
class TestPageSubscriptionSettings(TestCase, WagtailTestUtils):
|
||||
class TestPageSubscriptionSettings(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
@ -2913,7 +2913,7 @@ class TestPageSubscriptionSettings(TestCase, WagtailTestUtils):
|
|||
self.assertFalse(PageSubscription.objects.get().comment_notifications)
|
||||
|
||||
|
||||
class TestCommenting(TestCase, WagtailTestUtils):
|
||||
class TestCommenting(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Tests both the comment notification and audit logging logic of the edit page view.
|
||||
"""
|
||||
|
|
|
@ -11,7 +11,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
from wagtail.test.utils.timestamps import local_datetime
|
||||
|
||||
|
||||
class TestPageExplorer(TestCase, WagtailTestUtils):
|
||||
class TestPageExplorer(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
@ -374,7 +374,7 @@ class TestPageExplorer(TestCase, WagtailTestUtils):
|
|||
self.assertTemplateUsed(response, "wagtailadmin/pages/index.html")
|
||||
|
||||
|
||||
class TestBreadcrumb(TestCase, WagtailTestUtils):
|
||||
class TestBreadcrumb(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def test_breadcrumb_next_present(self):
|
||||
|
@ -418,7 +418,7 @@ class TestBreadcrumb(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, expected, html=True)
|
||||
|
||||
|
||||
class TestPageExplorerSidePanel(TestCase, WagtailTestUtils):
|
||||
class TestPageExplorerSidePanel(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def test_side_panel_present(self):
|
||||
|
@ -438,7 +438,7 @@ class TestPageExplorerSidePanel(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestPageExplorerSignposting(TestCase, WagtailTestUtils):
|
||||
class TestPageExplorerSignposting(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -601,7 +601,7 @@ class TestPageExplorerSignposting(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestExplorablePageVisibility(TestCase, WagtailTestUtils):
|
||||
class TestExplorablePageVisibility(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Test the way that the Explorable Pages functionality manifests within the Explorer.
|
||||
This is isolated in its own test case because it requires a custom page tree and custom set of
|
||||
|
@ -740,7 +740,7 @@ class TestExplorablePageVisibility(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAIL_I18N_ENABLED=True)
|
||||
class TestLocaleSelector(TestCase, WagtailTestUtils):
|
||||
class TestLocaleSelector(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -16,7 +16,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
from wagtail.users.models import UserProfile
|
||||
|
||||
|
||||
class TestApproveRejectModeration(TestCase, WagtailTestUtils):
|
||||
class TestApproveRejectModeration(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.submitter = self.create_superuser(
|
||||
username="submitter",
|
||||
|
@ -194,7 +194,7 @@ class TestApproveRejectModeration(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "Hello world!")
|
||||
|
||||
|
||||
class TestNotificationPreferences(TestCase, WagtailTestUtils):
|
||||
class TestNotificationPreferences(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
@ -372,7 +372,7 @@ class TestNotificationPreferences(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestApproveRejectModerationWithoutUser(TestCase, WagtailTestUtils):
|
||||
class TestApproveRejectModerationWithoutUser(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.submitter = self.create_superuser(
|
||||
username="submitter",
|
||||
|
|
|
@ -13,7 +13,7 @@ from wagtail.test.testapp.models import SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestPageMove(TestCase, WagtailTestUtils):
|
||||
class TestPageMove(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -9,7 +9,7 @@ from wagtail.test.testapp.models import SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestLocking(TestCase, WagtailTestUtils):
|
||||
class TestLocking(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
|
|
@ -9,7 +9,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
from wagtail.test.utils.timestamps import local_datetime
|
||||
|
||||
|
||||
class TestPageSearch(TestCase, WagtailTestUtils):
|
||||
class TestPageSearch(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ from wagtail.test.testapp.models import (
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestIssue2599(TestCase, WagtailTestUtils):
|
||||
class TestIssue2599(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
When previewing a page on creation, we need to assign it a path value consistent with its
|
||||
(future) position in the tree. The naive way of doing this is to give it an index number
|
||||
|
@ -85,7 +85,7 @@ def clear_edit_handler(page_cls):
|
|||
return decorator
|
||||
|
||||
|
||||
class TestPreview(TestCase, WagtailTestUtils):
|
||||
class TestPreview(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -415,7 +415,7 @@ class TestPreview(TestCase, WagtailTestUtils):
|
|||
self.assertTemplateUsed(response, template)
|
||||
|
||||
|
||||
class TestEnablePreview(TestCase, WagtailTestUtils):
|
||||
class TestEnablePreview(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
self.user = self.login()
|
||||
|
@ -563,7 +563,7 @@ class TestEnablePreview(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, preview_url)
|
||||
|
||||
|
||||
class TestDisablePreviewButton(TestCase, WagtailTestUtils):
|
||||
class TestDisablePreviewButton(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Test that preview button can be disabled by setting preview_modes to an empty list
|
||||
"""
|
||||
|
|
|
@ -6,7 +6,7 @@ from wagtail.test.testapp.models import BusinessChild, BusinessIndex, SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestPageReorder(TestCase, WagtailTestUtils):
|
||||
class TestPageReorder(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def __init__(self, methodName: str = ...) -> None:
|
||||
|
|
|
@ -17,7 +17,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
from wagtail.test.utils.timestamps import local_datetime
|
||||
|
||||
|
||||
class TestRevisions(TestCase, WagtailTestUtils):
|
||||
class TestRevisions(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -144,7 +144,7 @@ class TestRevisions(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, this_christmas_unschedule_url)
|
||||
|
||||
|
||||
class TestStreamRevisions(TestCase, WagtailTestUtils):
|
||||
class TestStreamRevisions(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
||||
|
@ -182,7 +182,7 @@ class TestStreamRevisions(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestCompareRevisions(TestCase, WagtailTestUtils):
|
||||
class TestCompareRevisions(WagtailTestUtils, TestCase):
|
||||
# Actual tests for the comparison classes can be found in test_compare.py
|
||||
|
||||
fixtures = ["test.json"]
|
||||
|
@ -278,7 +278,7 @@ class TestCompareRevisions(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestCompareRevisionsWithPerUserEditHandlers(TestCase, WagtailTestUtils):
|
||||
class TestCompareRevisionsWithPerUserEditHandlers(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -335,7 +335,7 @@ class TestCompareRevisionsWithPerUserEditHandlers(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestCompareRevisionsWithNonModelField(TestCase, WagtailTestUtils):
|
||||
class TestCompareRevisionsWithNonModelField(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Tests if form fields defined in the base_form_class will not be included.
|
||||
in revisions view as they are not actually on the model.
|
||||
|
@ -410,7 +410,7 @@ class TestCompareRevisionsWithNonModelField(TestCase, WagtailTestUtils):
|
|||
self.assertNotContains(response, "<h2>Code:</h2>")
|
||||
|
||||
|
||||
class TestRevisionsUnschedule(TestCase, WagtailTestUtils):
|
||||
class TestRevisionsUnschedule(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -568,7 +568,7 @@ class TestRevisionsUnschedule(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestRevisionsUnscheduleForUnpublishedPages(TestCase, WagtailTestUtils):
|
||||
class TestRevisionsUnscheduleForUnpublishedPages(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -12,7 +12,7 @@ from wagtail.test.testapp.models import SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestPageUnpublish(TestCase, WagtailTestUtils):
|
||||
class TestPageUnpublish(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -159,7 +159,7 @@ class TestPageUnpublish(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestPageUnpublishIncludingDescendants(TestCase, WagtailTestUtils):
|
||||
class TestPageUnpublishIncludingDescendants(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
# Find root page
|
||||
|
|
|
@ -8,7 +8,7 @@ from wagtail.test.testapp.models import SimplePage, StreamPage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestDraftAccess(TestCase, WagtailTestUtils):
|
||||
class TestDraftAccess(WagtailTestUtils, TestCase):
|
||||
"""Tests for the draft view access restrictions."""
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -6,7 +6,7 @@ from wagtail.models import Page
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestWorkflowHistoryDetail(TestCase, WagtailTestUtils):
|
||||
class TestWorkflowHistoryDetail(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -22,7 +22,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
from wagtail.users.models import UserProfile
|
||||
|
||||
|
||||
class TestAuthentication(TestCase, WagtailTestUtils):
|
||||
class TestAuthentication(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
This tests that users can login and logout of the admin interface
|
||||
"""
|
||||
|
@ -235,7 +235,7 @@ class TestAccountSectionUtilsMixin:
|
|||
return self.client.post(reverse("wagtailadmin_account"), post_data)
|
||||
|
||||
|
||||
class TestAccountSection(TestCase, WagtailTestUtils, TestAccountSectionUtilsMixin):
|
||||
class TestAccountSection(WagtailTestUtils, TestCase, TestAccountSectionUtilsMixin):
|
||||
"""
|
||||
This tests that the accounts section is working
|
||||
"""
|
||||
|
@ -553,7 +553,7 @@ class TestAccountSection(TestCase, WagtailTestUtils, TestAccountSectionUtilsMixi
|
|||
self.assertEqual(request.sensitive_post_parameters, "__ALL__")
|
||||
|
||||
|
||||
class TestAccountUploadAvatar(TestCase, WagtailTestUtils, TestAccountSectionUtilsMixin):
|
||||
class TestAccountUploadAvatar(WagtailTestUtils, TestCase, TestAccountSectionUtilsMixin):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.avatar = get_test_image_file()
|
||||
|
@ -644,7 +644,7 @@ class TestAccountUploadAvatar(TestCase, WagtailTestUtils, TestAccountSectionUtil
|
|||
self.assertIn("test.png", profile.avatar.url)
|
||||
|
||||
|
||||
class TestAccountManagementForNonModerator(TestCase, WagtailTestUtils):
|
||||
class TestAccountManagementForNonModerator(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Tests of reduced-functionality for editors
|
||||
"""
|
||||
|
@ -683,7 +683,7 @@ class TestAccountManagementForNonModerator(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
class TestAccountManagementForAdminOnlyUser(
|
||||
TestCase, WagtailTestUtils, TestAccountSectionUtilsMixin
|
||||
WagtailTestUtils, TestCase, TestAccountSectionUtilsMixin
|
||||
):
|
||||
"""
|
||||
Tests for users with no edit/publish permissions at all
|
||||
|
@ -711,7 +711,7 @@ class TestAccountManagementForAdminOnlyUser(
|
|||
self.assertPanelNotActive(response, "notifications")
|
||||
|
||||
|
||||
class TestPasswordReset(TestCase, WagtailTestUtils):
|
||||
class TestPasswordReset(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
This tests that the password reset is working
|
||||
"""
|
||||
|
|
|
@ -11,7 +11,7 @@ from wagtail.test.testapp.models import SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestAuditLogAdmin(TestCase, WagtailTestUtils):
|
||||
class TestAuditLogAdmin(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class ReorderOnlyPagePerms(BasePagePerms):
|
|||
return True
|
||||
|
||||
|
||||
class TestButtonsHooks(TestCase, WagtailTestUtils):
|
||||
class TestButtonsHooks(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ class CollectionInstanceTestUtils:
|
|||
self.marketing_user.groups.add(self.marketing_group)
|
||||
|
||||
|
||||
class TestCollectionsIndexViewAsSuperuser(TestCase, WagtailTestUtils):
|
||||
class TestCollectionsIndexViewAsSuperuser(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -101,7 +101,7 @@ class TestCollectionsIndexViewAsSuperuser(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestCollectionsIndexView(CollectionInstanceTestUtils, TestCase, WagtailTestUtils):
|
||||
class TestCollectionsIndexView(CollectionInstanceTestUtils, WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.login(self.marketing_user, password="password")
|
||||
|
@ -186,7 +186,7 @@ class TestCollectionsIndexView(CollectionInstanceTestUtils, TestCase, WagtailTes
|
|||
self.assertContains(response, "Add a collection")
|
||||
|
||||
|
||||
class TestAddCollectionAsSuperuser(TestCase, WagtailTestUtils):
|
||||
class TestAddCollectionAsSuperuser(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.root_collection = Collection.get_first_root_node()
|
||||
|
@ -221,7 +221,7 @@ class TestAddCollectionAsSuperuser(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestAddCollection(CollectionInstanceTestUtils, TestCase, WagtailTestUtils):
|
||||
class TestAddCollection(CollectionInstanceTestUtils, WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.login(self.marketing_user, password="password")
|
||||
|
@ -288,7 +288,7 @@ class TestAddCollection(CollectionInstanceTestUtils, TestCase, WagtailTestUtils)
|
|||
)
|
||||
|
||||
|
||||
class TestEditCollectionAsSuperuser(TestCase, WagtailTestUtils):
|
||||
class TestEditCollectionAsSuperuser(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.root_collection = Collection.get_first_root_node()
|
||||
|
@ -361,7 +361,7 @@ class TestEditCollectionAsSuperuser(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestEditCollection(CollectionInstanceTestUtils, TestCase, WagtailTestUtils):
|
||||
class TestEditCollection(CollectionInstanceTestUtils, WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
# Grant the marketing group permission to edit their collection
|
||||
|
@ -517,7 +517,7 @@ class TestEditCollection(CollectionInstanceTestUtils, TestCase, WagtailTestUtils
|
|||
self.assertContains(response, "Delete collection")
|
||||
|
||||
|
||||
class TestDeleteCollectionAsSuperuser(TestCase, WagtailTestUtils):
|
||||
class TestDeleteCollectionAsSuperuser(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.root_collection = Collection.get_first_root_node()
|
||||
|
@ -610,7 +610,7 @@ class TestDeleteCollectionAsSuperuser(TestCase, WagtailTestUtils):
|
|||
self.assertTrue(Collection.objects.get(id=self.root_collection.id))
|
||||
|
||||
|
||||
class TestDeleteCollection(CollectionInstanceTestUtils, TestCase, WagtailTestUtils):
|
||||
class TestDeleteCollection(CollectionInstanceTestUtils, WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
# Grant the marketing group permission to delete
|
||||
|
|
|
@ -5,7 +5,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
from wagtail.users.models import UserProfile
|
||||
|
||||
|
||||
class TestDismissiblesView(TestCase, WagtailTestUtils):
|
||||
class TestDismissiblesView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.profile = UserProfile.get_for_user(self.user)
|
||||
|
|
|
@ -368,7 +368,7 @@ class TestExtractPanelDefinitionsFromModelClass(TestCase):
|
|||
)
|
||||
|
||||
|
||||
class TestTabbedInterface(TestCase, WagtailTestUtils):
|
||||
class TestTabbedInterface(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.request = RequestFactory().get("/")
|
||||
user = self.create_superuser(username="admin")
|
||||
|
@ -1069,7 +1069,7 @@ class TestPageChooserPanel(TestCase):
|
|||
self.assertRaises(ImproperlyConfigured, panel.get_form_options)
|
||||
|
||||
|
||||
class TestInlinePanel(TestCase, WagtailTestUtils):
|
||||
class TestInlinePanel(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1380,7 +1380,7 @@ There are no tabs on non-Page model editing within InlinePanels.""",
|
|||
delattr(EventPageSpeaker, "content_panels")
|
||||
|
||||
|
||||
class TestCommentPanel(TestCase, WagtailTestUtils):
|
||||
class TestCommentPanel(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1696,7 +1696,7 @@ class TestCommentPanel(TestCase, WagtailTestUtils):
|
|||
# The existing reply was from the same user, so should be deletable
|
||||
|
||||
|
||||
class TestPublishingPanel(TestCase, WagtailTestUtils):
|
||||
class TestPublishingPanel(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1747,7 +1747,7 @@ class TestPublishingPanel(TestCase, WagtailTestUtils):
|
|||
self.assertIn("expire_at", form.base_fields)
|
||||
|
||||
|
||||
class TestMultipleChooserPanel(TestCase, WagtailTestUtils):
|
||||
class TestMultipleChooserPanel(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -9,7 +9,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
User = get_user_model()
|
||||
|
||||
|
||||
class TestFilteredModelChoiceField(TestCase, WagtailTestUtils):
|
||||
class TestFilteredModelChoiceField(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.musicians = Group.objects.create(name="Musicians")
|
||||
self.actors = Group.objects.create(name="Actors")
|
||||
|
|
|
@ -7,7 +7,7 @@ from wagtail.models import PAGE_TEMPLATE_VAR, Page, Site
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestCoreJinja(TestCase, WagtailTestUtils):
|
||||
class TestCoreJinja(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.engine = engines["jinja2"]
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ def menu_item_hook(*args, cls=MenuItem, **kwargs):
|
|||
return hook_fn
|
||||
|
||||
|
||||
class TestMenuRendering(TestCase, WagtailTestUtils):
|
||||
class TestMenuRendering(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.request = RequestFactory().get("/admin")
|
||||
self.request.user = self.create_superuser(username="admin")
|
||||
|
|
|
@ -7,7 +7,7 @@ from wagtail.test.testapp.models import SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestModerationList(TestCase, WagtailTestUtils):
|
||||
class TestModerationList(WagtailTestUtils, TestCase):
|
||||
"""Test moderation list rendered by `wagtailadmin_home` view"""
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -10,7 +10,7 @@ from wagtail.admin.navigation import (
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestExplorablePages(TestCase, WagtailTestUtils):
|
||||
class TestExplorablePages(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Test the way that the explorer nav menu behaves for users with different permissions.
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ from wagtail.test.testapp.models import (
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestChooserBrowse(TestCase, WagtailTestUtils):
|
||||
class TestChooserBrowse(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
||||
|
@ -51,7 +51,7 @@ class TestChooserBrowse(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.context["table"].data[1].specific, page)
|
||||
|
||||
|
||||
class TestCanChooseRootFlag(TestCase, WagtailTestUtils):
|
||||
class TestCanChooseRootFlag(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -67,7 +67,7 @@ class TestCanChooseRootFlag(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "/admin/pages/1/edit/")
|
||||
|
||||
|
||||
class TestChooserBrowseChild(TestCase, WagtailTestUtils):
|
||||
class TestChooserBrowseChild(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
||||
|
@ -307,7 +307,7 @@ class TestChooserBrowseChild(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.context["pagination_page"].number, 5)
|
||||
|
||||
|
||||
class TestChooserSearch(TestCase, WagtailTestUtils):
|
||||
class TestChooserSearch(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
||||
|
@ -444,7 +444,7 @@ class TestChooserSearch(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.context["pages"][0].specific, page)
|
||||
|
||||
|
||||
class TestAutomaticRootPageDetection(TestCase, WagtailTestUtils):
|
||||
class TestAutomaticRootPageDetection(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.tree_root = Page.objects.get(id=1)
|
||||
self.home_page = Page.objects.get(id=2)
|
||||
|
@ -534,7 +534,7 @@ class TestAutomaticRootPageDetection(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestChooserExternalLink(TestCase, WagtailTestUtils):
|
||||
class TestChooserExternalLink(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.internal_page = SimplePage(title="About", content="About Foo")
|
||||
|
@ -746,7 +746,7 @@ class TestChooserExternalLink(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response_json["internal"]["id"], self.internal_page.pk)
|
||||
|
||||
|
||||
class TestChooserAnchorLink(TestCase, WagtailTestUtils):
|
||||
class TestChooserAnchorLink(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -829,7 +829,7 @@ class TestChooserAnchorLink(TestCase, WagtailTestUtils):
|
|||
self.assertIs(result["prefer_this_title_as_link_text"], True)
|
||||
|
||||
|
||||
class TestChooserEmailLink(TestCase, WagtailTestUtils):
|
||||
class TestChooserEmailLink(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -912,7 +912,7 @@ class TestChooserEmailLink(TestCase, WagtailTestUtils):
|
|||
self.assertIs(result["prefer_this_title_as_link_text"], True)
|
||||
|
||||
|
||||
class TestChooserPhoneLink(TestCase, WagtailTestUtils):
|
||||
class TestChooserPhoneLink(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -991,7 +991,7 @@ class TestChooserPhoneLink(TestCase, WagtailTestUtils):
|
|||
self.assertIs(result["prefer_this_title_as_link_text"], True)
|
||||
|
||||
|
||||
class TestCanChoosePage(TestCase, WagtailTestUtils):
|
||||
class TestCanChoosePage(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1109,7 +1109,7 @@ class TestCanChoosePage(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAIL_I18N_ENABLED=True)
|
||||
class TestPageChooserLocaleSelector(TestCase, WagtailTestUtils):
|
||||
class TestPageChooserLocaleSelector(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
LOCALE_SELECTOR_HTML = '<a href="javascript:void(0)" aria-label="English" class="c-dropdown__button u-btn-current w-no-underline">'
|
||||
|
|
|
@ -8,7 +8,7 @@ from django.urls import reverse
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestUserPasswordReset(TestCase, WagtailTestUtils):
|
||||
class TestUserPasswordReset(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
# need to clear urlresolver caches before/after tests, because we override ROOT_URLCONF
|
||||
|
|
|
@ -7,7 +7,7 @@ from wagtail.test.testapp.models import SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestSetPrivacyView(TestCase, WagtailTestUtils):
|
||||
class TestSetPrivacyView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -302,7 +302,7 @@ class TestSetPrivacyView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestPrivacyIndicators(TestCase, WagtailTestUtils):
|
||||
class TestPrivacyIndicators(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ from wagtail.models import Page, PageLogEntry
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestLockedPagesView(TestCase, WagtailTestUtils):
|
||||
class TestLockedPagesView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -146,7 +146,7 @@ class TestLockedPagesView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(worksheet["E2"].number_format, ExcelDateFormatter().get())
|
||||
|
||||
|
||||
class TestFilteredLockedPagesView(TestCase, WagtailTestUtils):
|
||||
class TestFilteredLockedPagesView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -180,7 +180,7 @@ class TestFilteredLockedPagesView(TestCase, WagtailTestUtils):
|
|||
self.assertNotContains(response, "My locked page")
|
||||
|
||||
|
||||
class TestFilteredLogEntriesView(TestCase, WagtailTestUtils):
|
||||
class TestFilteredLogEntriesView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -303,7 +303,7 @@ class TestExcelDateFormatter(TestCase):
|
|||
self.assertEqual(formatter.format("m/d/Y g:i A"), "mm/dd/yyyy h:mm AM/PM")
|
||||
|
||||
|
||||
class TestAgingPagesView(TestCase, WagtailTestUtils):
|
||||
class TestAgingPagesView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.root = Page.objects.first()
|
||||
|
@ -425,7 +425,7 @@ class TestAgingPagesView(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, expected_deleted_string)
|
||||
|
||||
|
||||
class TestFilteredAgingPagesView(TestCase, WagtailTestUtils):
|
||||
class TestFilteredAgingPagesView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -84,7 +84,7 @@ class TestGetRichTextEditorWidget(TestCase):
|
|||
self.assertIsInstance(get_rich_text_editor_widget("custom"), CustomRichTextArea)
|
||||
|
||||
|
||||
class TestDefaultRichText(BaseRichTextEditHandlerTestCase, WagtailTestUtils):
|
||||
class TestDefaultRichText(WagtailTestUtils, BaseRichTextEditHandlerTestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
# Find root page
|
||||
|
@ -156,7 +156,7 @@ class TestDefaultRichText(BaseRichTextEditHandlerTestCase, WagtailTestUtils):
|
|||
},
|
||||
}
|
||||
)
|
||||
class TestDraftailFeatureMedia(BaseRichTextEditHandlerTestCase, WagtailTestUtils):
|
||||
class TestDraftailFeatureMedia(WagtailTestUtils, BaseRichTextEditHandlerTestCase):
|
||||
"""
|
||||
Features that define additional js/css imports (blockquote, in this case) should
|
||||
have those loaded on the page
|
||||
|
@ -199,7 +199,7 @@ class TestDraftailFeatureMedia(BaseRichTextEditHandlerTestCase, WagtailTestUtils
|
|||
"default": {"WIDGET": "wagtail.test.testapp.rich_text.LegacyRichTextArea"},
|
||||
}
|
||||
)
|
||||
class TestOverriddenDefaultRichText(BaseRichTextEditHandlerTestCase, WagtailTestUtils):
|
||||
class TestOverriddenDefaultRichText(WagtailTestUtils, BaseRichTextEditHandlerTestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
|
@ -248,7 +248,7 @@ class TestOverriddenDefaultRichText(BaseRichTextEditHandlerTestCase, WagtailTest
|
|||
"custom": {"WIDGET": "wagtail.test.testapp.rich_text.CustomRichTextArea"},
|
||||
}
|
||||
)
|
||||
class TestCustomDefaultRichText(BaseRichTextEditHandlerTestCase, WagtailTestUtils):
|
||||
class TestCustomDefaultRichText(WagtailTestUtils, BaseRichTextEditHandlerTestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
|
@ -318,7 +318,7 @@ class TestRichTextValue(TestCase):
|
|||
},
|
||||
}
|
||||
)
|
||||
class TestDraftailWithFeatureOptions(BaseRichTextEditHandlerTestCase, WagtailTestUtils):
|
||||
class TestDraftailWithFeatureOptions(WagtailTestUtils, BaseRichTextEditHandlerTestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
||||
|
@ -354,7 +354,7 @@ class TestDraftailWithFeatureOptions(BaseRichTextEditHandlerTestCase, WagtailTes
|
|||
|
||||
|
||||
class TestDraftailWithAdditionalFeatures(
|
||||
BaseRichTextEditHandlerTestCase, WagtailTestUtils
|
||||
WagtailTestUtils, BaseRichTextEditHandlerTestCase
|
||||
):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
|
|
|
@ -8,7 +8,7 @@ from wagtail.test.testapp.models import SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestPagesSummary(TestCase, WagtailTestUtils):
|
||||
class TestPagesSummary(WagtailTestUtils, TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
|
|
|
@ -30,7 +30,7 @@ from wagtail.users.models import UserProfile
|
|||
from wagtail.utils.deprecation import RemovedInWagtail60Warning
|
||||
|
||||
|
||||
class TestAvatarTemplateTag(TestCase, WagtailTestUtils):
|
||||
class TestAvatarTemplateTag(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create a user
|
||||
self.test_user = self.create_user(
|
||||
|
|
|
@ -4,7 +4,7 @@ from wagtail.admin.views.home import UpgradeNotificationPanel
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestUpgradeNotificationPanel(TestCase, WagtailTestUtils):
|
||||
class TestUpgradeNotificationPanel(WagtailTestUtils, TestCase):
|
||||
DATA_ATTRIBUTE_UPGRADE_CHECK = "data-w-upgrade"
|
||||
DATA_ATTRIBUTE_UPGRADE_CHECK_LTS = "data-w-upgrade-lts-only"
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from wagtail.test.testapp.models import BusinessChild, BusinessIndex
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestUserbarTag(TestCase, WagtailTestUtils):
|
||||
class TestUserbarTag(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.create_superuser(
|
||||
username="test", email="test@email.com", password="password"
|
||||
|
@ -166,7 +166,7 @@ class TestUserbarTag(TestCase, WagtailTestUtils):
|
|||
self.assertIn("Empty heading found", content)
|
||||
|
||||
|
||||
class TestUserbarFrontend(TestCase, WagtailTestUtils):
|
||||
class TestUserbarFrontend(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.homepage = Page.objects.get(id=2)
|
||||
|
@ -191,7 +191,7 @@ class TestUserbarFrontend(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
|
||||
class TestUserbarAddLink(TestCase, WagtailTestUtils):
|
||||
class TestUserbarAddLink(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -239,7 +239,7 @@ class TestUserbarAddLink(TestCase, WagtailTestUtils):
|
|||
self.assertNotContains(response, expected_link)
|
||||
|
||||
|
||||
class TestUserbarModeration(TestCase, WagtailTestUtils):
|
||||
class TestUserbarModeration(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.homepage = Page.objects.get(id=2)
|
||||
|
|
|
@ -7,7 +7,7 @@ from wagtail.models import Page
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestLoginView(TestCase, WagtailTestUtils):
|
||||
class TestLoginView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -5,7 +5,7 @@ from django.urls import reverse
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestGenericIndexView(TestCase, WagtailTestUtils):
|
||||
class TestGenericIndexView(WagtailTestUtils, TestCase):
|
||||
|
||||
fixtures = ["test.json"]
|
||||
|
||||
|
@ -21,7 +21,7 @@ class TestGenericIndexView(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "second modelwithstringtypeprimarykey model")
|
||||
|
||||
|
||||
class TestGenericEditView(TestCase, WagtailTestUtils):
|
||||
class TestGenericEditView(WagtailTestUtils, TestCase):
|
||||
|
||||
fixtures = ["test.json"]
|
||||
|
||||
|
@ -58,7 +58,7 @@ class TestGenericEditView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(delete_url_pk, quote(object_pk))
|
||||
|
||||
|
||||
class TestGenericDeleteView(TestCase, WagtailTestUtils):
|
||||
class TestGenericDeleteView(WagtailTestUtils, TestCase):
|
||||
|
||||
fixtures = ["test.json"]
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
from wagtail.users.models import UserProfile
|
||||
|
||||
|
||||
class TestWhatsNewInWagtailVersionPanel(TestCase, WagtailTestUtils):
|
||||
class TestWhatsNewInWagtailVersionPanel(WagtailTestUtils, TestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
cls.panel = WhatsNewInWagtailVersionPanel()
|
||||
|
@ -57,7 +57,7 @@ class TestWhatsNewInWagtailVersionPanel(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(result, "")
|
||||
|
||||
|
||||
class TestWhatsNewOnDashboard(TestCase, WagtailTestUtils):
|
||||
class TestWhatsNewOnDashboard(WagtailTestUtils, TestCase):
|
||||
"""Test 'What's New In Wagtail' banner rendered by `wagtailadmin_home` view"""
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -45,7 +45,7 @@ def delete_existing_workflows():
|
|||
WorkflowTask.objects.all().delete()
|
||||
|
||||
|
||||
class TestWorkflowMenus(TestCase, WagtailTestUtils):
|
||||
class TestWorkflowMenus(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -81,7 +81,7 @@ class TestWorkflowMenus(TestCase, WagtailTestUtils):
|
|||
self.assertNotContains(response, '"url": "/admin/reports/workflow_tasks/"')
|
||||
|
||||
|
||||
class TestWorkflowsIndexView(TestCase, WagtailTestUtils):
|
||||
class TestWorkflowsIndexView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
delete_existing_workflows()
|
||||
self.login()
|
||||
|
@ -157,7 +157,7 @@ class TestWorkflowsIndexView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
class TestWorkflowsCreateView(TestCase, WagtailTestUtils):
|
||||
class TestWorkflowsCreateView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
delete_existing_workflows()
|
||||
self.login()
|
||||
|
@ -367,7 +367,7 @@ class TestWorkflowsCreateView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(link.workflow, workflow)
|
||||
|
||||
|
||||
class TestWorkflowsEditView(TestCase, WagtailTestUtils):
|
||||
class TestWorkflowsEditView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
delete_existing_workflows()
|
||||
self.login()
|
||||
|
@ -644,7 +644,7 @@ class TestWorkflowsEditView(TestCase, WagtailTestUtils):
|
|||
self.assertFalse(self.workflow.workflow_content_types.exists())
|
||||
|
||||
|
||||
class TestRemoveWorkflow(TestCase, WagtailTestUtils):
|
||||
class TestRemoveWorkflow(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -703,7 +703,7 @@ class TestRemoveWorkflow(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
|
||||
class TestTaskIndexView(TestCase, WagtailTestUtils):
|
||||
class TestTaskIndexView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
delete_existing_workflows()
|
||||
self.login()
|
||||
|
@ -780,7 +780,7 @@ class TestTaskIndexView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
class TestCreateTaskView(TestCase, WagtailTestUtils):
|
||||
class TestCreateTaskView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
delete_existing_workflows()
|
||||
self.login()
|
||||
|
@ -866,7 +866,7 @@ class TestCreateTaskView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
class TestSelectTaskTypeView(TestCase, WagtailTestUtils):
|
||||
class TestSelectTaskTypeView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
delete_existing_workflows()
|
||||
self.login()
|
||||
|
@ -906,7 +906,7 @@ class TestSelectTaskTypeView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestEditTaskView(TestCase, WagtailTestUtils):
|
||||
class TestEditTaskView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
delete_existing_workflows()
|
||||
self.login()
|
||||
|
@ -989,7 +989,7 @@ class TestEditTaskView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(moderator_url_finder.get_edit_url(self.task), expected_url)
|
||||
|
||||
|
||||
class BasePageWorkflowTests(TestCase, WagtailTestUtils):
|
||||
class BasePageWorkflowTests(WagtailTestUtils, TestCase):
|
||||
model_name = "page"
|
||||
|
||||
def setUp(self):
|
||||
|
@ -2812,7 +2812,7 @@ class TestSnippetWorkflowPreview(TestPageWorkflowPreview, BaseSnippetWorkflowTes
|
|||
self.object.save_revision()
|
||||
|
||||
|
||||
class TestTaskChooserView(TestCase, WagtailTestUtils):
|
||||
class TestTaskChooserView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -3047,7 +3047,7 @@ class TestTaskChooserView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestTaskChooserChosenView(TestCase, WagtailTestUtils):
|
||||
class TestTaskChooserChosenView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
delete_existing_workflows()
|
||||
self.login()
|
||||
|
@ -3075,7 +3075,7 @@ class TestTaskChooserChosenView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestWorkflowUsageView(TestCase, WagtailTestUtils):
|
||||
class TestWorkflowUsageView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.workflow = Workflow.objects.get()
|
||||
|
|
|
@ -21,7 +21,7 @@ from wagtail.test.testapp.models import RestaurantTag
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestHome(TestCase, WagtailTestUtils):
|
||||
class TestHome(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Login
|
||||
self.login()
|
||||
|
@ -116,7 +116,7 @@ class TestHome(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
class TestEditorHooks(TestCase, WagtailTestUtils):
|
||||
class TestEditorHooks(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.homepage = Page.objects.get(id=2)
|
||||
self.login()
|
||||
|
@ -308,7 +308,7 @@ class TestSendMail(TestCase):
|
|||
self.assertEqual(mail.outbox[0].reply_to, ["reply_to.test@email.com"])
|
||||
|
||||
|
||||
class TestTagsAutocomplete(TestCase, WagtailTestUtils):
|
||||
class TestTagsAutocomplete(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
Tag.objects.create(name="Test", slug="test")
|
||||
|
@ -385,7 +385,7 @@ class TestTagsAutocomplete(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(data, [])
|
||||
|
||||
|
||||
class TestMenuItem(TestCase, WagtailTestUtils):
|
||||
class TestMenuItem(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
response = self.client.get(reverse("wagtailadmin_home"))
|
||||
|
@ -396,7 +396,7 @@ class TestMenuItem(TestCase, WagtailTestUtils):
|
|||
self.assertIs(menuitem.is_active(self.request), True)
|
||||
|
||||
|
||||
class TestUserPassesTestPermissionDecorator(TestCase, WagtailTestUtils):
|
||||
class TestUserPassesTestPermissionDecorator(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Test for custom user_passes_test permission decorators.
|
||||
testapp_bob_only_zone is a view configured to only grant access to users with a first_name of Bob
|
||||
|
@ -435,7 +435,7 @@ class TestUserPassesTestPermissionDecorator(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
|
||||
class TestUserHasAnyPagePermission(TestCase, WagtailTestUtils):
|
||||
class TestUserHasAnyPagePermission(WagtailTestUtils, TestCase):
|
||||
def test_superuser(self):
|
||||
user = self.create_superuser(
|
||||
username="superuser", email="admin@example.com", password="p"
|
||||
|
@ -473,7 +473,7 @@ class TestUserHasAnyPagePermission(TestCase, WagtailTestUtils):
|
|||
self.assertFalse(user_has_any_page_permission(user))
|
||||
|
||||
|
||||
class Test404(TestCase, WagtailTestUtils):
|
||||
class Test404(WagtailTestUtils, TestCase):
|
||||
def test_admin_404_template_used_append_slash_true(self):
|
||||
self.login()
|
||||
with self.settings(APPEND_SLASH=True):
|
||||
|
@ -492,7 +492,7 @@ class Test404(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestAdminURLAppendSlash(TestCase, WagtailTestUtils):
|
||||
class TestAdminURLAppendSlash(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Find root page
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
|
|
@ -187,7 +187,7 @@ class TestAdaptSearchModule(TestCase):
|
|||
)
|
||||
|
||||
|
||||
class TestAdaptMainMenuModule(DjangoTestCase, WagtailTestUtils):
|
||||
class TestAdaptMainMenuModule(WagtailTestUtils, DjangoTestCase):
|
||||
def test_adapt(self):
|
||||
main_menu = [
|
||||
LinkMenuItem("pages", "Pages", "/pages/"),
|
||||
|
|
|
@ -28,7 +28,7 @@ def get_total_page_count():
|
|||
)
|
||||
|
||||
|
||||
class TestPageListing(TestCase, WagtailTestUtils):
|
||||
class TestPageListing(WagtailTestUtils, TestCase):
|
||||
fixtures = ["demosite.json"]
|
||||
|
||||
def get_response(self, **params):
|
||||
|
|
|
@ -204,7 +204,7 @@ class TestFormSubmission(TestCase):
|
|||
self.assertIn("hello world", str(submission))
|
||||
|
||||
|
||||
class TestFormWithCustomSubmission(TestCase, WagtailTestUtils):
|
||||
class TestFormWithCustomSubmission(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create a form page
|
||||
self.form_page = make_form_page_with_custom_submission()
|
||||
|
@ -480,7 +480,7 @@ class TestFormSubmissionWithMultipleRecipients(TestCase):
|
|||
|
||||
|
||||
class TestFormSubmissionWithMultipleRecipientsAndWithCustomSubmission(
|
||||
TestCase, WagtailTestUtils
|
||||
WagtailTestUtils, TestCase
|
||||
):
|
||||
def setUp(self):
|
||||
# Create a form page
|
||||
|
@ -566,7 +566,7 @@ class TestFormWithRedirect(TestCase):
|
|||
)
|
||||
|
||||
|
||||
class TestFormPageWithCustomFormBuilder(TestCase, WagtailTestUtils):
|
||||
class TestFormPageWithCustomFormBuilder(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
|
||||
home_page = Page.objects.get(url_path="/home/")
|
||||
|
@ -780,7 +780,7 @@ class TestCleanedDataEmails(TestCase):
|
|||
self.assertIn("Datetime: 12/21/1910 9:19 p.m.", mail.outbox[2].body)
|
||||
|
||||
|
||||
class TestIssue798(TestCase, WagtailTestUtils):
|
||||
class TestIssue798(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -831,7 +831,7 @@ class TestNonHtmlExtension(TestCase):
|
|||
)
|
||||
|
||||
|
||||
class TestFormFieldCleanNameCreation(TestCase, WagtailTestUtils):
|
||||
class TestFormFieldCleanNameCreation(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -852,7 +852,7 @@ class TestFormFieldCleanNameCreation(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(field.clean_name, "telefon_nummer")
|
||||
|
||||
|
||||
class TestFormFieldCleanNameCreationOverride(TestCase, WagtailTestUtils):
|
||||
class TestFormFieldCleanNameCreationOverride(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create a form page
|
||||
home_page = Page.objects.get(url_path="/home/")
|
||||
|
|
|
@ -75,7 +75,7 @@ class TestFormResponsesPanel(TestCase):
|
|||
self.assertFalse(self.panel.is_shown())
|
||||
|
||||
|
||||
class TestFormResponsesPanelWithCustomSubmissionClass(TestCase, WagtailTestUtils):
|
||||
class TestFormResponsesPanelWithCustomSubmissionClass(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.request = RequestFactory().get("/")
|
||||
user = AnonymousUser() # technically, Anonymous users cannot access the admin
|
||||
|
@ -124,7 +124,7 @@ class TestFormResponsesPanelWithCustomSubmissionClass(TestCase, WagtailTestUtils
|
|||
self.assertFalse(self.panel.is_shown())
|
||||
|
||||
|
||||
class TestFormsIndex(TestCase, WagtailTestUtils):
|
||||
class TestFormsIndex(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -232,7 +232,7 @@ class TestFormsIndex(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAIL_I18N_ENABLED=True)
|
||||
class TestFormsIndexWithLocalisationEnabled(TestCase, WagtailTestUtils):
|
||||
class TestFormsIndexWithLocalisationEnabled(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -327,7 +327,7 @@ class TestFormsIndexWithLocalisationEnabled(TestCase, WagtailTestUtils):
|
|||
self.assertNotContains(response, self.get_switch_link_markup(self.fr_locale))
|
||||
|
||||
|
||||
class TestFormsSubmissionsList(TestCase, WagtailTestUtils):
|
||||
class TestFormsSubmissionsList(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create a form page
|
||||
self.form_page = make_form_page()
|
||||
|
@ -515,7 +515,7 @@ class TestFormsSubmissionsList(TestCase, WagtailTestUtils):
|
|||
self.assertIn("this is a really old message", first_row_values)
|
||||
|
||||
|
||||
class TestFormsSubmissionsExport(TestCase, WagtailTestUtils):
|
||||
class TestFormsSubmissionsExport(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create a form page
|
||||
self.form_page = make_form_page()
|
||||
|
@ -820,7 +820,7 @@ class TestFormsSubmissionsExport(TestCase, WagtailTestUtils):
|
|||
self.assertIn("vim", data_lines[1])
|
||||
|
||||
|
||||
class TestCustomFormsSubmissionsExport(TestCase, WagtailTestUtils):
|
||||
class TestCustomFormsSubmissionsExport(WagtailTestUtils, TestCase):
|
||||
def create_test_user_without_admin(self, username):
|
||||
return self.create_user(username=username, password="123")
|
||||
|
||||
|
@ -1027,7 +1027,7 @@ class TestCustomFormsSubmissionsExport(TestCase, WagtailTestUtils):
|
|||
self.assertIn("vim", data_lines[1])
|
||||
|
||||
|
||||
class TestCustomFormsSubmissionsList(TestCase, WagtailTestUtils):
|
||||
class TestCustomFormsSubmissionsList(WagtailTestUtils, TestCase):
|
||||
def create_test_user_without_admin(self, username):
|
||||
return self.create_user(username=username, password="123")
|
||||
|
||||
|
@ -1198,7 +1198,7 @@ class TestCustomFormsSubmissionsList(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestDeleteFormSubmission(TestCase, WagtailTestUtils):
|
||||
class TestDeleteFormSubmission(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1291,7 +1291,7 @@ class TestDeleteFormSubmission(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestDeleteCustomFormSubmission(TestCase, WagtailTestUtils):
|
||||
class TestDeleteCustomFormSubmission(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1362,7 +1362,7 @@ class TestDeleteCustomFormSubmission(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(CustomFormPageSubmission.objects.count(), 2)
|
||||
|
||||
|
||||
class TestFormsWithCustomSubmissionsList(TestCase, WagtailTestUtils):
|
||||
class TestFormsWithCustomSubmissionsList(WagtailTestUtils, TestCase):
|
||||
def create_test_user_without_admin(self, username):
|
||||
return self.create_user(username=username, password="123")
|
||||
|
||||
|
@ -1557,7 +1557,7 @@ class TestFormsWithCustomSubmissionsList(TestCase, WagtailTestUtils):
|
|||
self.assertIn("Old chocolate idea", first_row_values)
|
||||
|
||||
|
||||
class TestFormsWithCustomFormBuilderSubmissionsList(TestCase, WagtailTestUtils):
|
||||
class TestFormsWithCustomFormBuilderSubmissionsList(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
home_page = Page.objects.get(url_path="/home/")
|
||||
form_page = home_page.add_child(
|
||||
|
@ -1612,7 +1612,7 @@ class TestFormsWithCustomFormBuilderSubmissionsList(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "192.0.2.15")
|
||||
|
||||
|
||||
class TestDuplicateFormFieldLabels(TestCase, WagtailTestUtils):
|
||||
class TestDuplicateFormFieldLabels(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
If a user creates two fields with the same label, data cannot be saved correctly.
|
||||
See: https://github.com/wagtail/wagtail/issues/585
|
||||
|
@ -1777,7 +1777,7 @@ class TestDuplicateFormFieldLabels(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestPreview(TestCase, WagtailTestUtils):
|
||||
class TestPreview(WagtailTestUtils, TestCase):
|
||||
|
||||
post_data = {
|
||||
"title": "Form page!",
|
||||
|
|
|
@ -8,7 +8,7 @@ from wagtail.test.modeladmintest.wagtail_hooks import PersonAdmin
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestExtractPanelDefinitionsFromModelAdmin(TestCase, WagtailTestUtils):
|
||||
class TestExtractPanelDefinitionsFromModelAdmin(WagtailTestUtils, TestCase):
|
||||
"""tests that edit_handler and panels can be defined on modeladmin"""
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -6,7 +6,7 @@ from wagtail.test.testapp.models import BusinessIndex, EventCategory, EventPage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestIndexView(TestCase, WagtailTestUtils):
|
||||
class TestIndexView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test_specific.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -63,7 +63,7 @@ class TestIndexView(TestCase, WagtailTestUtils):
|
|||
self.assertNotIn(root_page, response.context["paginator"].object_list)
|
||||
|
||||
|
||||
class TestExcludeFromExplorer(TestCase, WagtailTestUtils):
|
||||
class TestExcludeFromExplorer(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -84,7 +84,7 @@ class TestExcludeFromExplorer(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "Claim your free present!")
|
||||
|
||||
|
||||
class TestCreateView(TestCase, WagtailTestUtils):
|
||||
class TestCreateView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test_specific.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -111,7 +111,7 @@ class TestCreateView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestInspectView(TestCase, WagtailTestUtils):
|
||||
class TestInspectView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test_specific.json", "modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -192,7 +192,7 @@ class TestInspectView(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, expected, html=True)
|
||||
|
||||
|
||||
class TestEditView(TestCase, WagtailTestUtils):
|
||||
class TestEditView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test_specific.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -222,7 +222,7 @@ class TestEditView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
|
||||
class TestDeleteView(TestCase, WagtailTestUtils):
|
||||
class TestDeleteView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test_specific.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -241,7 +241,7 @@ class TestDeleteView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestChooseParentView(TestCase, WagtailTestUtils):
|
||||
class TestChooseParentView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test_specific.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -287,7 +287,7 @@ class TestChooseParentView(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, expected, html=True)
|
||||
|
||||
|
||||
class TestChooseParentViewForNonSuperuser(TestCase, WagtailTestUtils):
|
||||
class TestChooseParentViewForNonSuperuser(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test_specific.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -334,7 +334,7 @@ class TestChooseParentViewForNonSuperuser(TestCase, WagtailTestUtils):
|
|||
self.assertNotContains(response, "Private Business Index")
|
||||
|
||||
|
||||
class TestEditorAccess(TestCase, WagtailTestUtils):
|
||||
class TestEditorAccess(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test_specific.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -349,7 +349,7 @@ class TestEditorAccess(TestCase, WagtailTestUtils):
|
|||
self.assertRedirects(response, "/admin/")
|
||||
|
||||
|
||||
class TestModeratorAccess(TestCase, WagtailTestUtils):
|
||||
class TestModeratorAccess(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test_specific.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -366,7 +366,7 @@ class TestModeratorAccess(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestSearch(TestCase, WagtailTestUtils):
|
||||
class TestSearch(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test_specific.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -28,7 +28,7 @@ from wagtail.test.modeladmintest.wagtail_hooks import BookModelAdmin, EventsAdmi
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestBookIndexView(TestCase, WagtailTestUtils):
|
||||
class TestBookIndexView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -233,7 +233,7 @@ class TestBookIndexView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.context["result_count"], 4)
|
||||
|
||||
|
||||
class TestAuthorIndexView(TestCase, WagtailTestUtils):
|
||||
class TestAuthorIndexView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -305,7 +305,7 @@ class TestAuthorIndexView(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAIL_I18N_ENABLED=True)
|
||||
class TestTranslatableBookIndexView(TestCase, WagtailTestUtils):
|
||||
class TestTranslatableBookIndexView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -357,7 +357,7 @@ class TestTranslatableBookIndexView(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "Le Seigneur des anneaux", html=True)
|
||||
|
||||
|
||||
class TestCreateView(TestCase, WagtailTestUtils):
|
||||
class TestCreateView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -474,7 +474,7 @@ class TestCreateView(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAIL_I18N_ENABLED=True)
|
||||
class TestTranslatableCreateView(TestCase, WagtailTestUtils):
|
||||
class TestTranslatableCreateView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -500,7 +500,7 @@ class TestTranslatableCreateView(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, expected, html=True)
|
||||
|
||||
|
||||
class TestRevisableCreateView(TestCase, WagtailTestUtils):
|
||||
class TestRevisableCreateView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -530,7 +530,7 @@ class TestRevisableCreateView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(log_entries.first().revision, revision)
|
||||
|
||||
|
||||
class TestInspectView(TestCase, WagtailTestUtils):
|
||||
class TestInspectView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -611,7 +611,7 @@ class TestInspectView(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, expected, html=True)
|
||||
|
||||
|
||||
class TestEditView(TestCase, WagtailTestUtils):
|
||||
class TestEditView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -743,7 +743,7 @@ class TestEditView(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAIL_I18N_ENABLED=True)
|
||||
class TestTranslatableBookEditView(TestCase, WagtailTestUtils):
|
||||
class TestTranslatableBookEditView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -776,7 +776,7 @@ class TestTranslatableBookEditView(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, expected, html=True)
|
||||
|
||||
|
||||
class TestRevisableEditView(TestCase, WagtailTestUtils):
|
||||
class TestRevisableEditView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.instance = Publisher.objects.create(name="foo")
|
||||
|
@ -809,7 +809,7 @@ class TestRevisableEditView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(log_entries.first().revision, revision)
|
||||
|
||||
|
||||
class TestPageSpecificViews(TestCase, WagtailTestUtils):
|
||||
class TestPageSpecificViews(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
expected_status_code = 404
|
||||
|
||||
|
@ -821,7 +821,7 @@ class TestPageSpecificViews(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, self.expected_status_code)
|
||||
|
||||
|
||||
class TestConfirmDeleteView(TestCase, WagtailTestUtils):
|
||||
class TestConfirmDeleteView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -853,7 +853,7 @@ class TestConfirmDeleteView(TestCase, WagtailTestUtils):
|
|||
self.assertFalse(Book.objects.filter(id=1).exists())
|
||||
|
||||
|
||||
class TestDeleteViewWithProtectedRelation(TestCase, WagtailTestUtils):
|
||||
class TestDeleteViewWithProtectedRelation(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -911,7 +911,7 @@ class TestDeleteViewWithProtectedRelation(TestCase, WagtailTestUtils):
|
|||
self.assertTrue(Author.objects.filter(id=5).exists())
|
||||
|
||||
|
||||
class TestDeleteViewModelReprPrimary(TestCase, WagtailTestUtils):
|
||||
class TestDeleteViewModelReprPrimary(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -922,7 +922,7 @@ class TestDeleteViewModelReprPrimary(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
|
||||
class TestEditorAccess(TestCase, WagtailTestUtils):
|
||||
class TestEditorAccess(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1024,7 +1024,7 @@ class TestEditorAccess(TestCase, WagtailTestUtils):
|
|||
self.assertRedirects(response, "/admin/modeladmintest/book/")
|
||||
|
||||
|
||||
class TestHistoryView(TestCase, WagtailTestUtils):
|
||||
class TestHistoryView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1047,7 +1047,7 @@ class TestHistoryView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestQuoting(TestCase, WagtailTestUtils):
|
||||
class TestQuoting(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
expected_status_code = 200
|
||||
|
||||
|
@ -1080,7 +1080,7 @@ class TestQuoting(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
class TestPanelConfigurationChecks(TestCase, WagtailTestUtils):
|
||||
class TestPanelConfigurationChecks(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.warning_id = "wagtailadmin.W002"
|
||||
|
||||
|
@ -1158,7 +1158,7 @@ There are no default tabs on non-Page models so there will be no\
|
|||
delattr(Publisher, "edit_handler")
|
||||
|
||||
|
||||
class TestMenuSetting(TestCase, WagtailTestUtils):
|
||||
class TestMenuSetting(WagtailTestUtils, TestCase):
|
||||
fixtures = ["modeladmintest_test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -14,7 +14,7 @@ TEST_ROOT = os.path.abspath(os.path.dirname(__file__))
|
|||
@override_settings(
|
||||
ALLOWED_HOSTS=["testserver", "localhost", "test.example.com", "other.example.com"]
|
||||
)
|
||||
class TestImportAdminViews(TestCase, WagtailTestUtils):
|
||||
class TestImportAdminViews(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
|
|
@ -572,7 +572,7 @@ class TestRedirects(TestCase):
|
|||
self.assertIs(redirect.is_permanent, True)
|
||||
|
||||
|
||||
class TestRedirectsIndexView(TestCase, WagtailTestUtils):
|
||||
class TestRedirectsIndexView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -620,7 +620,7 @@ class TestRedirectsIndexView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.context["redirects"][0].old_path, "/aaargh")
|
||||
|
||||
|
||||
class TestRedirectsAddView(TestCase, WagtailTestUtils):
|
||||
class TestRedirectsAddView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -771,7 +771,7 @@ class TestRedirectsAddView(TestCase, WagtailTestUtils):
|
|||
self.assertIsNone(redirects.first().site)
|
||||
|
||||
|
||||
class TestRedirectsEditView(TestCase, WagtailTestUtils):
|
||||
class TestRedirectsEditView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create a redirect to edit
|
||||
self.redirect = models.Redirect(
|
||||
|
@ -880,7 +880,7 @@ class TestRedirectsEditView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
class TestRedirectsDeleteView(TestCase, WagtailTestUtils):
|
||||
class TestRedirectsDeleteView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create a redirect to edit
|
||||
self.redirect = models.Redirect(
|
||||
|
|
|
@ -9,7 +9,7 @@ from wagtail.models import Site
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestRedirectReport(TestCase, WagtailTestUtils):
|
||||
class TestRedirectReport(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ User = get_user_model()
|
|||
|
||||
|
||||
@override_settings(WAGTAILREDIRECTS_AUTO_CREATE=True)
|
||||
class TestAutocreateRedirects(TestCase, WagtailTestUtils):
|
||||
class TestAutocreateRedirects(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -84,7 +84,7 @@ class TestGetSearchPromotionsTemplateTag(TestCase):
|
|||
self.assertEqual(search_picks, [])
|
||||
|
||||
|
||||
class TestSearchPromotionsIndexView(TestCase, WagtailTestUtils):
|
||||
class TestSearchPromotionsIndexView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -235,7 +235,7 @@ class TestSearchPromotionsIndexView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.context["queries"][-2].query_string, "suboptimal")
|
||||
|
||||
|
||||
class TestSearchPromotionsAddView(TestCase, WagtailTestUtils):
|
||||
class TestSearchPromotionsAddView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -285,7 +285,7 @@ class TestSearchPromotionsAddView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestSearchPromotionsEditView(TestCase, WagtailTestUtils):
|
||||
class TestSearchPromotionsEditView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -447,7 +447,7 @@ class TestSearchPromotionsEditView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestSearchPromotionsDeleteView(TestCase, WagtailTestUtils):
|
||||
class TestSearchPromotionsDeleteView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ from wagtail.test.testapp.models import (
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestGenericSettingMenu(TestCase, WagtailTestUtils):
|
||||
class TestGenericSettingMenu(WagtailTestUtils, TestCase):
|
||||
def login_only_admin(self):
|
||||
"""Log in with a user that only has permission to access the admin"""
|
||||
user = self.create_user(username="test", password="password")
|
||||
|
@ -68,7 +68,7 @@ class TestGenericSettingMenu(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class BaseTestGenericSettingView(TestCase, WagtailTestUtils):
|
||||
class BaseTestGenericSettingView(WagtailTestUtils, TestCase):
|
||||
def get(self, params={}, setting=TestGenericSetting):
|
||||
url = self.edit_url(setting=setting)
|
||||
return self.client.get(url, params)
|
||||
|
@ -164,7 +164,7 @@ class TestGenericSettingEditView(BaseTestGenericSettingView):
|
|||
)
|
||||
|
||||
|
||||
class TestAdminPermission(TestCase, WagtailTestUtils):
|
||||
class TestAdminPermission(WagtailTestUtils, TestCase):
|
||||
def test_registered_permission(self):
|
||||
permission = Permission.objects.get_by_natural_key(
|
||||
app_label="tests",
|
||||
|
|
|
@ -6,7 +6,7 @@ from wagtail.test.testapp.models import NotYetRegisteredGenericSetting
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class GenericSettingRegisterTestCase(TestCase, WagtailTestUtils):
|
||||
class GenericSettingRegisterTestCase(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.registry = Registry()
|
||||
self.login()
|
||||
|
|
|
@ -11,7 +11,7 @@ from .base import GenericSettingsTestMixin
|
|||
|
||||
@override_settings(ALLOWED_HOSTS=["testserver", "localhost", "other"])
|
||||
class GenericSettingTemplateTestCase(
|
||||
GenericSettingsTestMixin, TestCase, WagtailTestUtils
|
||||
GenericSettingsTestMixin, WagtailTestUtils, TestCase
|
||||
):
|
||||
def render(self, request, string, context=None):
|
||||
template = Template(string)
|
||||
|
|
|
@ -19,7 +19,7 @@ from wagtail.test.testapp.models import (
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestSiteSettingMenu(TestCase, WagtailTestUtils):
|
||||
class TestSiteSettingMenu(WagtailTestUtils, TestCase):
|
||||
def login_only_admin(self):
|
||||
"""Log in with a user that only has permission to access the admin"""
|
||||
user = self.create_user(username="test", password="password")
|
||||
|
@ -67,7 +67,7 @@ class TestSiteSettingMenu(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class BaseTestSiteSettingView(TestCase, WagtailTestUtils):
|
||||
class BaseTestSiteSettingView(WagtailTestUtils, TestCase):
|
||||
def get(self, site_pk=1, params={}, setting=TestSiteSetting):
|
||||
url = self.edit_url(setting=setting, site_pk=site_pk)
|
||||
return self.client.get(url, params)
|
||||
|
@ -265,7 +265,7 @@ class TestMultiSite(BaseTestSiteSettingView):
|
|||
self.assertEqual(default_setting.email, "default@example.com")
|
||||
|
||||
|
||||
class TestAdminPermission(TestCase, WagtailTestUtils):
|
||||
class TestAdminPermission(WagtailTestUtils, TestCase):
|
||||
def test_registered_permission(self):
|
||||
permission = Permission.objects.get_by_natural_key(
|
||||
app_label="tests",
|
||||
|
|
|
@ -6,7 +6,7 @@ from wagtail.test.testapp.models import NotYetRegisteredSiteSetting
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestRegister(TestCase, WagtailTestUtils):
|
||||
class TestRegister(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.registry = Registry()
|
||||
self.login()
|
||||
|
|
|
@ -10,7 +10,7 @@ from .base import SiteSettingsTestMixin
|
|||
|
||||
|
||||
@override_settings(ALLOWED_HOSTS=["testserver", "localhost", "other"])
|
||||
class TemplateTestCase(SiteSettingsTestMixin, TestCase, WagtailTestUtils):
|
||||
class TemplateTestCase(SiteSettingsTestMixin, WagtailTestUtils, TestCase):
|
||||
def render(self, request, string, context=None, site=None):
|
||||
template = Template(string)
|
||||
context = RequestContext(request, context)
|
||||
|
|
|
@ -4,7 +4,7 @@ from django.urls import reverse
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestStyleGuide(TestCase, WagtailTestUtils):
|
||||
class TestStyleGuide(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
|
|
@ -491,7 +491,7 @@ class TestTableBlockForm(WagtailTestUtils, SimpleTestCase):
|
|||
|
||||
|
||||
# TODO(telepath) replace this with a functional test
|
||||
class TestTableBlockPageEdit(TestCase, WagtailTestUtils):
|
||||
class TestTableBlockPageEdit(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.value = {
|
||||
"first_row_is_table_header": True,
|
||||
|
|
|
@ -22,7 +22,7 @@ from wagtail.test.testapp.models import (
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestDocumentIndexView(TestCase, WagtailTestUtils):
|
||||
class TestDocumentIndexView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -170,7 +170,7 @@ class TestDocumentIndexView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestDocumentListingResultsView(TestCase, WagtailTestUtils):
|
||||
class TestDocumentListingResultsView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -189,7 +189,7 @@ class TestDocumentListingResultsView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestDocumentAddView(TestCase, WagtailTestUtils):
|
||||
class TestDocumentAddView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -327,7 +327,7 @@ class TestDocumentAddView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestDocumentAddViewWithLimitedCollectionPermissions(TestCase, WagtailTestUtils):
|
||||
class TestDocumentAddViewWithLimitedCollectionPermissions(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
add_doc_permission = Permission.objects.get(
|
||||
content_type__app_label="wagtaildocs", codename="add_document"
|
||||
|
@ -403,7 +403,7 @@ class TestDocumentAddViewWithLimitedCollectionPermissions(TestCase, WagtailTestU
|
|||
)
|
||||
|
||||
|
||||
class TestDocumentEditView(TestCase, WagtailTestUtils):
|
||||
class TestDocumentEditView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -652,7 +652,7 @@ class TestDocumentEditView(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAILDOCS_DOCUMENT_MODEL="tests.CustomDocument")
|
||||
class TestDocumentEditViewWithCustomDocumentModel(TestCase, WagtailTestUtils):
|
||||
class TestDocumentEditViewWithCustomDocumentModel(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -709,7 +709,7 @@ class TestDocumentEditViewWithCustomDocumentModel(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestDocumentDeleteView(TestCase, WagtailTestUtils):
|
||||
class TestDocumentDeleteView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -764,7 +764,7 @@ class TestDocumentDeleteView(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "Used 0 times")
|
||||
|
||||
|
||||
class TestMultipleDocumentUploader(TestCase, WagtailTestUtils):
|
||||
class TestMultipleDocumentUploader(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
This tests the multiple document upload views located in wagtaildocs/views/multiple.py
|
||||
"""
|
||||
|
@ -1438,7 +1438,7 @@ class TestMultipleCustomDocumentUploaderWithRequiredField(TestMultipleDocumentUp
|
|||
self.assertTrue(response_json["success"])
|
||||
|
||||
|
||||
class TestDocumentChooserView(TestCase, WagtailTestUtils):
|
||||
class TestDocumentChooserView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -1596,7 +1596,7 @@ class TestDocumentChooserView(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "<td>Root</td>")
|
||||
|
||||
|
||||
class TestDocumentChooserChosenView(TestCase, WagtailTestUtils):
|
||||
class TestDocumentChooserChosenView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -1612,7 +1612,7 @@ class TestDocumentChooserChosenView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response_json["step"], "chosen")
|
||||
|
||||
|
||||
class TestDocumentChooserUploadView(TestCase, WagtailTestUtils):
|
||||
class TestDocumentChooserUploadView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -1675,7 +1675,7 @@ class TestDocumentChooserUploadView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestDocumentChooserUploadViewWithLimitedPermissions(TestCase, WagtailTestUtils):
|
||||
class TestDocumentChooserUploadViewWithLimitedPermissions(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
add_doc_permission = Permission.objects.get(
|
||||
content_type__app_label="wagtaildocs", codename="add_document"
|
||||
|
@ -1748,7 +1748,7 @@ class TestDocumentChooserUploadViewWithLimitedPermissions(TestCase, WagtailTestU
|
|||
self.assertEqual(doc.get().collection, self.evil_plans_collection)
|
||||
|
||||
|
||||
class TestUsageCount(TestCase, WagtailTestUtils):
|
||||
class TestUsageCount(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1782,7 +1782,7 @@ class TestUsageCount(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "Used 0 times")
|
||||
|
||||
|
||||
class TestGetUsage(TestCase, WagtailTestUtils):
|
||||
class TestGetUsage(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -1883,7 +1883,7 @@ class TestGetUsage(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
|
||||
class TestEditOnlyPermissions(TestCase, WagtailTestUtils):
|
||||
class TestEditOnlyPermissions(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Build a fake file
|
||||
fake_file = get_test_document_file()
|
||||
|
|
|
@ -12,7 +12,7 @@ def get_tag_list(document):
|
|||
return [tag.name for tag in document.tags.all()]
|
||||
|
||||
|
||||
class TestBulkAddTags(TestCase, WagtailTestUtils):
|
||||
class TestBulkAddTags(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.new_tags = ["first", "second"]
|
||||
|
|
|
@ -9,7 +9,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
Document = get_document_model()
|
||||
|
||||
|
||||
class TestBulkAddDocumentsToCollection(TestCase, WagtailTestUtils):
|
||||
class TestBulkAddDocumentsToCollection(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.root_collection = Collection.get_first_root_node()
|
||||
|
|
|
@ -8,7 +8,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
Document = get_document_model()
|
||||
|
||||
|
||||
class TestDocumentBulkDeleteView(TestCase, WagtailTestUtils):
|
||||
class TestDocumentBulkDeleteView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ except ImportError:
|
|||
from urllib import quote
|
||||
|
||||
|
||||
class TestCollectionPrivacyDocument(TestCase, WagtailTestUtils):
|
||||
class TestCollectionPrivacyDocument(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -12,7 +12,7 @@ from wagtail.models import (
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestChooser(TestCase, WagtailTestUtils):
|
||||
class TestChooser(WagtailTestUtils, TestCase):
|
||||
"""Test chooser panel rendered by `wagtaildocs_chooser:choose` view"""
|
||||
|
||||
_NO_DOCS_TEXT = "You haven't uploaded any documents."
|
||||
|
|
|
@ -48,7 +48,7 @@ class TestDocumentQuerySet(TestCase):
|
|||
self.assertEqual(list(results), [zzz_document, aaa_document])
|
||||
|
||||
|
||||
class TestDocumentPermissions(TestCase, WagtailTestUtils):
|
||||
class TestDocumentPermissions(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create some user accounts for testing permissions
|
||||
self.user = self.create_user(
|
||||
|
|
|
@ -10,7 +10,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
|
||||
|
||||
@override_settings(_WAGTAILSEARCH_FORCE_AUTO_UPDATE=["elasticsearch"])
|
||||
class TestIssue613(TestCase, WagtailTestUtils):
|
||||
class TestIssue613(WagtailTestUtils, TestCase):
|
||||
def get_elasticsearch_backend(self):
|
||||
from django.conf import settings
|
||||
|
||||
|
|
|
@ -272,7 +272,7 @@ class TestEmbedHash(TestCase):
|
|||
self.assertEqual(get_embed_hash(url, 1), "427830227a86093b50417e11dbd2f28e")
|
||||
|
||||
|
||||
class TestChooser(TestCase, WagtailTestUtils):
|
||||
class TestChooser(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# login
|
||||
self.login()
|
||||
|
|
|
@ -32,7 +32,7 @@ from .utils import Image, get_test_image_file
|
|||
urlquote_safechars = RFC3986_SUBDELIMS + str("/~:@")
|
||||
|
||||
|
||||
class TestImageIndexView(TestCase, WagtailTestUtils):
|
||||
class TestImageIndexView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.kitten_image = Image.objects.create(
|
||||
|
@ -387,7 +387,7 @@ class TestImageIndexView(TestCase, WagtailTestUtils):
|
|||
self.get()
|
||||
|
||||
|
||||
class TestImageListingResultsView(TestCase, WagtailTestUtils):
|
||||
class TestImageListingResultsView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -409,7 +409,7 @@ class TestImageListingResultsView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestImageAddView(TestCase, WagtailTestUtils):
|
||||
class TestImageAddView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -644,7 +644,7 @@ class TestImageAddView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestImageAddViewWithLimitedCollectionPermissions(TestCase, WagtailTestUtils):
|
||||
class TestImageAddViewWithLimitedCollectionPermissions(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
add_image_permission = Permission.objects.get(
|
||||
content_type__app_label="wagtailimages", codename="add_image"
|
||||
|
@ -724,7 +724,7 @@ class TestImageAddViewWithLimitedCollectionPermissions(TestCase, WagtailTestUtil
|
|||
)
|
||||
|
||||
|
||||
class TestImageEditView(TestCase, WagtailTestUtils):
|
||||
class TestImageEditView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -1081,7 +1081,7 @@ class TestImageEditView(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAILIMAGES_IMAGE_MODEL="tests.CustomImage")
|
||||
class TestImageEditViewWithCustomImageModel(TestCase, WagtailTestUtils):
|
||||
class TestImageEditViewWithCustomImageModel(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -1110,7 +1110,7 @@ class TestImageEditViewWithCustomImageModel(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "wagtailadmin/js/draftail.js")
|
||||
|
||||
|
||||
class TestImageDeleteView(TestCase, WagtailTestUtils):
|
||||
class TestImageDeleteView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -1166,7 +1166,7 @@ class TestImageDeleteView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
|
||||
class TestUsage(TestCase, WagtailTestUtils):
|
||||
class TestUsage(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -1285,7 +1285,7 @@ class TestUsage(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 302)
|
||||
|
||||
|
||||
class TestImageChooserView(TestCase, WagtailTestUtils):
|
||||
class TestImageChooserView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -1493,7 +1493,7 @@ class TestImageChooserView(TestCase, WagtailTestUtils):
|
|||
self.get()
|
||||
|
||||
|
||||
class TestImageChooserChosenView(TestCase, WagtailTestUtils):
|
||||
class TestImageChooserChosenView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -1527,7 +1527,7 @@ class TestImageChooserChosenView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response_json["result"][0]["title"], "Test image")
|
||||
|
||||
|
||||
class TestImageChooserChosenMultipleView(TestCase, WagtailTestUtils):
|
||||
class TestImageChooserChosenMultipleView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -1567,7 +1567,7 @@ class TestImageChooserChosenMultipleView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(titles, {"Test image", "Another test image"})
|
||||
|
||||
|
||||
class TestImageChooserSelectFormatView(TestCase, WagtailTestUtils):
|
||||
class TestImageChooserSelectFormatView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -1662,7 +1662,7 @@ class TestImageChooserSelectFormatView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestImageChooserUploadView(TestCase, WagtailTestUtils):
|
||||
class TestImageChooserUploadView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -1944,7 +1944,7 @@ class TestImageChooserUploadView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestImageChooserUploadViewWithLimitedPermissions(TestCase, WagtailTestUtils):
|
||||
class TestImageChooserUploadViewWithLimitedPermissions(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
add_image_permission = Permission.objects.get(
|
||||
content_type__app_label="wagtailimages", codename="add_image"
|
||||
|
@ -2023,7 +2023,7 @@ class TestImageChooserUploadViewWithLimitedPermissions(TestCase, WagtailTestUtil
|
|||
)
|
||||
|
||||
|
||||
class TestMultipleImageUploader(TestCase, WagtailTestUtils):
|
||||
class TestMultipleImageUploader(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
This tests the multiple image upload views located in wagtailimages/views/multiple.py
|
||||
"""
|
||||
|
@ -2510,7 +2510,7 @@ class TestMultipleImageUploader(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAILIMAGES_IMAGE_MODEL="tests.CustomImage")
|
||||
class TestMultipleImageUploaderWithCustomImageModel(TestCase, WagtailTestUtils):
|
||||
class TestMultipleImageUploaderWithCustomImageModel(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
This tests the multiple image upload views located in wagtailimages/views/multiple.py
|
||||
with a custom image model
|
||||
|
@ -2791,7 +2791,7 @@ class TestMultipleImageUploaderWithCustomImageModel(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAILIMAGES_IMAGE_MODEL="tests.CustomImageWithAuthor")
|
||||
class TestMultipleImageUploaderWithCustomRequiredFields(TestCase, WagtailTestUtils):
|
||||
class TestMultipleImageUploaderWithCustomRequiredFields(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
This tests the multiple image upload views located in wagtailimages/views/multiple.py
|
||||
with a custom image model
|
||||
|
@ -3026,7 +3026,7 @@ class TestMultipleImageUploaderWithCustomRequiredFields(TestCase, WagtailTestUti
|
|||
self.assertTrue(response_json["success"])
|
||||
|
||||
|
||||
class TestURLGeneratorView(TestCase, WagtailTestUtils):
|
||||
class TestURLGeneratorView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create an image for running tests on
|
||||
self.image = Image.objects.create(
|
||||
|
@ -3073,7 +3073,7 @@ class TestURLGeneratorView(TestCase, WagtailTestUtils):
|
|||
self.assertRedirects(response, reverse("wagtailadmin_home"))
|
||||
|
||||
|
||||
class TestGenerateURLView(TestCase, WagtailTestUtils):
|
||||
class TestGenerateURLView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create an image for running tests on
|
||||
self.image = Image.objects.create(
|
||||
|
@ -3202,7 +3202,7 @@ class TestGenerateURLView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestPreviewView(TestCase, WagtailTestUtils):
|
||||
class TestPreviewView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create an image for running tests on
|
||||
self.image = Image.objects.create(
|
||||
|
@ -3244,7 +3244,7 @@ class TestPreviewView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 400)
|
||||
|
||||
|
||||
class TestEditOnlyPermissions(TestCase, WagtailTestUtils):
|
||||
class TestEditOnlyPermissions(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create an image to edit
|
||||
self.image = Image.objects.create(
|
||||
|
@ -3313,7 +3313,7 @@ class TestEditOnlyPermissions(TestCase, WagtailTestUtils):
|
|||
self.assertRedirects(response, reverse("wagtailadmin_home"))
|
||||
|
||||
|
||||
class TestImageAddMultipleView(TestCase, WagtailTestUtils):
|
||||
class TestImageAddMultipleView(WagtailTestUtils, TestCase):
|
||||
def test_as_superuser(self):
|
||||
self.login()
|
||||
response = self.client.get(reverse("wagtailimages:add_multiple"))
|
||||
|
|
|
@ -14,7 +14,7 @@ def get_tag_list(image):
|
|||
return [tag.name for tag in image.tags.all()]
|
||||
|
||||
|
||||
class TestBulkAddTags(TestCase, WagtailTestUtils):
|
||||
class TestBulkAddTags(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.new_tags = ["first", "second"]
|
||||
|
|
|
@ -11,7 +11,7 @@ Image = get_image_model()
|
|||
test_file = get_test_image_file()
|
||||
|
||||
|
||||
class TestBulkAddImagesToCollection(TestCase, WagtailTestUtils):
|
||||
class TestBulkAddImagesToCollection(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.root_collection = Collection.get_first_root_node()
|
||||
|
|
|
@ -10,7 +10,7 @@ Image = get_image_model()
|
|||
test_file = get_test_image_file()
|
||||
|
||||
|
||||
class TestImageBulkDeleteView(TestCase, WagtailTestUtils):
|
||||
class TestImageBulkDeleteView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
|
|
@ -173,7 +173,7 @@ class TestImageQuerySet(TestCase):
|
|||
self.assertIn("aardvark", results["Test image 0"])
|
||||
|
||||
|
||||
class TestImagePermissions(TestCase, WagtailTestUtils):
|
||||
class TestImagePermissions(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create some user accounts for testing permissions
|
||||
self.user = self.create_user(
|
||||
|
@ -645,7 +645,7 @@ class TestIssue573(TestCase):
|
|||
|
||||
|
||||
@override_settings(_WAGTAILSEARCH_FORCE_AUTO_UPDATE=["elasticsearch"])
|
||||
class TestIssue613(TestCase, WagtailTestUtils):
|
||||
class TestIssue613(WagtailTestUtils, TestCase):
|
||||
def get_elasticsearch_backend(self):
|
||||
from django.conf import settings
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
from .utils import Image, get_test_image_file
|
||||
|
||||
|
||||
class TestEditorHtmlImageEmbedHandler(TestCase, WagtailTestUtils):
|
||||
class TestEditorHtmlImageEmbedHandler(WagtailTestUtils, TestCase):
|
||||
def test_get_db_attributes(self):
|
||||
soup = BeautifulSoup(
|
||||
'<b data-id="test-id" data-format="test-format" data-alt="test-alt">foo</b>',
|
||||
|
@ -90,7 +90,7 @@ class TestEditorHtmlImageEmbedHandler(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestFrontendImageEmbedHandler(TestCase, WagtailTestUtils):
|
||||
class TestFrontendImageEmbedHandler(WagtailTestUtils, TestCase):
|
||||
def test_expand_db_attributes_for_frontend(self):
|
||||
Image.objects.create(id=1, title="Test", file=get_test_image_file())
|
||||
result = FrontendImageEmbedHandler.expand_db_attributes(
|
||||
|
@ -132,7 +132,7 @@ class TestFrontendImageEmbedHandler(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestExtractReferencesWithImage(TestCase, WagtailTestUtils):
|
||||
class TestExtractReferencesWithImage(WagtailTestUtils, TestCase):
|
||||
def test_extract_references(self):
|
||||
self.assertEqual(
|
||||
list(
|
||||
|
|
|
@ -229,7 +229,7 @@ class TestMissingImage(TestCase):
|
|||
)
|
||||
|
||||
|
||||
class TestFormat(TestCase, WagtailTestUtils):
|
||||
class TestFormat(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# test format
|
||||
self.format = Format("test name", "test label", "test classnames", "original")
|
||||
|
@ -642,7 +642,7 @@ class TestRect(TestCase):
|
|||
self.assertEqual(rect, Rect(75, 190, 125, 210))
|
||||
|
||||
|
||||
class TestGetImageForm(TestCase, WagtailTestUtils):
|
||||
class TestGetImageForm(WagtailTestUtils, TestCase):
|
||||
def test_fields(self):
|
||||
form = get_image_form(Image)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ from wagtail.models import Locale, Page
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestLocaleIndexView(TestCase, WagtailTestUtils):
|
||||
class TestLocaleIndexView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -21,7 +21,7 @@ class TestLocaleIndexView(TestCase, WagtailTestUtils):
|
|||
self.assertTemplateUsed(response, "wagtailadmin/generic/index.html")
|
||||
|
||||
|
||||
class TestLocaleCreateView(TestCase, WagtailTestUtils):
|
||||
class TestLocaleCreateView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.english = Locale.objects.get()
|
||||
|
@ -92,7 +92,7 @@ class TestLocaleCreateView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestLocaleEditView(TestCase, WagtailTestUtils):
|
||||
class TestLocaleEditView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.english = Locale.objects.get()
|
||||
|
@ -200,7 +200,7 @@ class TestLocaleEditView(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestLocaleDeleteView(TestCase, WagtailTestUtils):
|
||||
class TestLocaleDeleteView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.english = Locale.objects.get()
|
||||
|
|
|
@ -47,7 +47,7 @@ class TestGetIndexedInstance(TestCase):
|
|||
"default": {"BACKEND": "wagtail.search.tests.DummySearchBackend"}
|
||||
}
|
||||
)
|
||||
class TestInsertOrUpdateObject(TestCase, WagtailTestUtils):
|
||||
class TestInsertOrUpdateObject(WagtailTestUtils, TestCase):
|
||||
def test_inserts_object(self, backend):
|
||||
obj = models.Book.objects.create(
|
||||
title="Test", publication_date=date(2017, 10, 18), number_of_pages=100
|
||||
|
@ -110,7 +110,7 @@ class TestInsertOrUpdateObject(TestCase, WagtailTestUtils):
|
|||
"default": {"BACKEND": "wagtail.search.tests.DummySearchBackend"}
|
||||
}
|
||||
)
|
||||
class TestRemoveObject(TestCase, WagtailTestUtils):
|
||||
class TestRemoveObject(WagtailTestUtils, TestCase):
|
||||
def test_removes_object(self, backend):
|
||||
obj = models.Book.objects.create(
|
||||
title="Test", publication_date=date(2017, 10, 18), number_of_pages=100
|
||||
|
@ -157,7 +157,7 @@ class TestRemoveObject(TestCase, WagtailTestUtils):
|
|||
"default": {"BACKEND": "wagtail.search.tests.DummySearchBackend"}
|
||||
}
|
||||
)
|
||||
class TestSignalHandlers(TestCase, WagtailTestUtils):
|
||||
class TestSignalHandlers(WagtailTestUtils, TestCase):
|
||||
def test_index_on_create(self, backend):
|
||||
backend().reset_mock()
|
||||
obj = models.Book.objects.create(
|
||||
|
|
|
@ -178,7 +178,7 @@ class TestGarbageCollectCommand(TestCase):
|
|||
)
|
||||
|
||||
|
||||
class TestQueryChooserView(TestCase, WagtailTestUtils):
|
||||
class TestQueryChooserView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ from wagtail.models import Page, Site
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestSiteIndexView(TestCase, WagtailTestUtils):
|
||||
class TestSiteIndexView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.home_page = Page.objects.get(id=2)
|
||||
|
@ -27,7 +27,7 @@ class TestSiteIndexView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
class TestSiteCreateView(TestCase, WagtailTestUtils):
|
||||
class TestSiteCreateView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.home_page = Page.objects.get(id=2)
|
||||
|
@ -130,7 +130,7 @@ class TestSiteCreateView(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(Site.objects.filter(hostname="localhost").count(), 1)
|
||||
|
||||
|
||||
class TestSiteEditView(TestCase, WagtailTestUtils):
|
||||
class TestSiteEditView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.home_page = Page.objects.get(id=2)
|
||||
|
@ -248,7 +248,7 @@ class TestSiteEditView(TestCase, WagtailTestUtils):
|
|||
self.assertIs(Site.objects.get(id=second_site.id).is_default_site, False)
|
||||
|
||||
|
||||
class TestSiteDeleteView(TestCase, WagtailTestUtils):
|
||||
class TestSiteDeleteView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
self.home_page = Page.objects.get(id=2)
|
||||
|
@ -284,7 +284,7 @@ class TestSiteDeleteView(TestCase, WagtailTestUtils):
|
|||
Site.objects.get(id=self.localhost.id)
|
||||
|
||||
|
||||
class TestLimitedPermissions(TestCase, WagtailTestUtils):
|
||||
class TestLimitedPermissions(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Create a user
|
||||
user = self.create_user(username="test", password="password")
|
||||
|
|
|
@ -6,7 +6,7 @@ from wagtail.test.snippets.models import StandardSnippet
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestSnippetDeleteView(TestCase, WagtailTestUtils):
|
||||
class TestSnippetDeleteView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.snippet_model = StandardSnippet
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ from wagtail.test.testapp.models import (
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class BaseLockingTestCase(TestCase, WagtailTestUtils):
|
||||
class BaseLockingTestCase(WagtailTestUtils, TestCase):
|
||||
model = LockableModel
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -16,7 +16,7 @@ from wagtail.test.testapp.models import (
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestPreview(TestCase, WagtailTestUtils):
|
||||
class TestPreview(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -276,7 +276,7 @@ class TestPreview(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "Multiple modes (Alternate Preview)")
|
||||
|
||||
|
||||
class TestEnablePreview(TestCase, WagtailTestUtils):
|
||||
class TestEnablePreview(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.single = PreviewableModel.objects.create(text="Single preview mode")
|
||||
|
@ -418,7 +418,7 @@ class TestEnablePreview(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, preview_url)
|
||||
|
||||
|
||||
class TestDisablePreviewWithEmptyModes(TestCase, WagtailTestUtils):
|
||||
class TestDisablePreviewWithEmptyModes(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Preview can be disabled by setting preview_modes to an empty list.
|
||||
"""
|
||||
|
|
|
@ -70,7 +70,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
from wagtail.test.utils.timestamps import rendered_timestamp, submittable_timestamp
|
||||
|
||||
|
||||
class TestSnippetIndexView(TestCase, WagtailTestUtils):
|
||||
class TestSnippetIndexView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -98,7 +98,7 @@ class TestSnippetIndexView(TestCase, WagtailTestUtils):
|
|||
self.assertContains(self.get(), "Adverts")
|
||||
|
||||
|
||||
class TestSnippetListView(TestCase, WagtailTestUtils):
|
||||
class TestSnippetListView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
user_model = get_user_model()
|
||||
|
@ -212,7 +212,7 @@ class TestSnippetListView(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAIL_I18N_ENABLED=True)
|
||||
class TestLocaleSelectorOnList(TestCase, WagtailTestUtils):
|
||||
class TestLocaleSelectorOnList(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.fr_locale = Locale.objects.create(language_code="fr")
|
||||
self.user = self.login()
|
||||
|
@ -287,7 +287,7 @@ class TestLocaleSelectorOnList(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestModelOrdering(TestCase, WagtailTestUtils):
|
||||
class TestModelOrdering(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
for i in range(1, 10):
|
||||
AdvertWithTabbedInterface.objects.create(text="advert %d" % i)
|
||||
|
@ -309,7 +309,7 @@ class TestModelOrdering(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.context["items"][0].text, "aaaadvert")
|
||||
|
||||
|
||||
class TestListViewOrdering(TestCase, WagtailTestUtils):
|
||||
class TestListViewOrdering(WagtailTestUtils, TestCase):
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
for i in range(1, 10):
|
||||
|
@ -451,7 +451,7 @@ class TestListViewOrdering(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, list_url + "?ordering=live")
|
||||
|
||||
|
||||
class TestSnippetListViewWithSearchableSnippet(TestCase, WagtailTestUtils):
|
||||
class TestSnippetListViewWithSearchableSnippet(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -516,7 +516,7 @@ class TestSnippetListViewWithSearchableSnippet(TestCase, WagtailTestUtils):
|
|||
self.assertIn(self.snippet_c, items)
|
||||
|
||||
|
||||
class TestSnippetListViewWithFilterSet(TestCase, WagtailTestUtils):
|
||||
class TestSnippetListViewWithFilterSet(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -617,7 +617,7 @@ class TestSnippetListViewWithFilterSet(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestListViewWithCustomColumns(TestCase, WagtailTestUtils):
|
||||
class TestListViewWithCustomColumns(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -653,7 +653,7 @@ class TestListViewWithCustomColumns(TestCase, WagtailTestUtils):
|
|||
self.assertTagInHTML("<th>", html, count=5, allow_extra_attrs=True)
|
||||
|
||||
|
||||
class TestSnippetCreateView(TestCase, WagtailTestUtils):
|
||||
class TestSnippetCreateView(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -910,7 +910,7 @@ class TestSnippetCreateView(TestCase, WagtailTestUtils):
|
|||
|
||||
|
||||
@override_settings(WAGTAIL_I18N_ENABLED=True)
|
||||
class TestLocaleSelectorOnCreate(TestCase, WagtailTestUtils):
|
||||
class TestLocaleSelectorOnCreate(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -938,7 +938,7 @@ class TestLocaleSelectorOnCreate(TestCase, WagtailTestUtils):
|
|||
self.assertNotContains(response, "Switch locales")
|
||||
|
||||
|
||||
class TestCreateDraftStateSnippet(TestCase, WagtailTestUtils):
|
||||
class TestCreateDraftStateSnippet(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
@ -1285,7 +1285,7 @@ class TestCreateDraftStateSnippet(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(snippet.status_string, "scheduled")
|
||||
|
||||
|
||||
class BaseTestSnippetEditView(TestCase, WagtailTestUtils):
|
||||
class BaseTestSnippetEditView(WagtailTestUtils, TestCase):
|
||||
def get_edit_url(self):
|
||||
snippet = self.test_snippet
|
||||
app_label = snippet._meta.app_label
|
||||
|
@ -3198,7 +3198,7 @@ class TestScheduledForPublishLock(BaseTestSnippetEditView):
|
|||
)
|
||||
|
||||
|
||||
class TestSnippetUnschedule(TestCase, WagtailTestUtils):
|
||||
class TestSnippetUnschedule(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.test_snippet = DraftStateCustomPrimaryKeyModel.objects.create(
|
||||
|
@ -3338,7 +3338,7 @@ class TestSnippetUnschedule(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestSnippetUnpublish(TestCase, WagtailTestUtils):
|
||||
class TestSnippetUnpublish(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
self.snippet = DraftStateCustomPrimaryKeyModel.objects.create(
|
||||
|
@ -3542,7 +3542,7 @@ class TestSnippetUnpublish(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(self.snippet.status_string, "live")
|
||||
|
||||
|
||||
class TestSnippetDelete(TestCase, WagtailTestUtils):
|
||||
class TestSnippetDelete(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -3703,7 +3703,7 @@ class TestSnippetDelete(TestCase, WagtailTestUtils):
|
|||
self.assertFalse(Advert.objects.filter(pk=advert.pk).exists())
|
||||
|
||||
|
||||
class TestSnippetDeleteMultipleWithOne(TestCase, WagtailTestUtils):
|
||||
class TestSnippetDeleteMultipleWithOne(WagtailTestUtils, TestCase):
|
||||
# test deletion of one snippet using the delete-multiple URL
|
||||
# behaviour should mimic the TestSnippetDelete but with different URl structure
|
||||
fixtures = ["test.json"]
|
||||
|
@ -3730,7 +3730,7 @@ class TestSnippetDeleteMultipleWithOne(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(Advert.objects.filter(text="test_advert").count(), 0)
|
||||
|
||||
|
||||
class TestSnippetDeleteMultipleWithThree(TestCase, WagtailTestUtils):
|
||||
class TestSnippetDeleteMultipleWithThree(WagtailTestUtils, TestCase):
|
||||
# test deletion of three snippets using the delete-multiple URL
|
||||
fixtures = ["test.json"]
|
||||
|
||||
|
@ -3765,7 +3765,7 @@ class TestSnippetDeleteMultipleWithThree(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(Advert.objects.filter(text="test_advert").count(), 0)
|
||||
|
||||
|
||||
class TestSnippetChooserPanel(TestCase, WagtailTestUtils):
|
||||
class TestSnippetChooserPanel(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -3888,7 +3888,7 @@ class TestUsedBy(TestCase):
|
|||
self.assertIsInstance(advert.get_usage()[0][1][0], ReferenceIndex)
|
||||
|
||||
|
||||
class TestSnippetUsageView(TestCase, WagtailTestUtils):
|
||||
class TestSnippetUsageView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -3983,7 +3983,7 @@ class TestSnippetUsageView(TestCase, WagtailTestUtils):
|
|||
self.assertContains(response, "(Private page)")
|
||||
|
||||
|
||||
class TestSnippetHistory(TestCase, WagtailTestUtils):
|
||||
class TestSnippetHistory(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def get(self, snippet, params={}):
|
||||
|
@ -4120,7 +4120,7 @@ class TestSnippetHistory(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
|
||||
class TestSnippetRevisions(TestCase, WagtailTestUtils):
|
||||
class TestSnippetRevisions(WagtailTestUtils, TestCase):
|
||||
@property
|
||||
def revert_url(self):
|
||||
return self.get_url(
|
||||
|
@ -4416,7 +4416,7 @@ class TestSnippetRevisions(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(self.snippet.live_revision, self.snippet.latest_revision)
|
||||
|
||||
|
||||
class TestCompareRevisions(TestCase, WagtailTestUtils):
|
||||
class TestCompareRevisions(WagtailTestUtils, TestCase):
|
||||
# Actual tests for the comparison classes can be found in test_compare.py
|
||||
|
||||
def setUp(self):
|
||||
|
@ -4489,7 +4489,7 @@ class TestCompareRevisions(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestCompareRevisionsWithPerUserPanels(TestCase, WagtailTestUtils):
|
||||
class TestCompareRevisionsWithPerUserPanels(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.snippet = RevisableChildModel.objects.create(
|
||||
text="Foo bar", secret_text="Secret text"
|
||||
|
@ -4541,7 +4541,7 @@ class TestCompareRevisionsWithPerUserPanels(TestCase, WagtailTestUtils):
|
|||
self.assertNotContains(response, "unseen note")
|
||||
|
||||
|
||||
class TestSnippetChoose(TestCase, WagtailTestUtils):
|
||||
class TestSnippetChoose(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -4639,7 +4639,7 @@ class TestSnippetChoose(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.context["items"][0].text, "English snippet")
|
||||
|
||||
|
||||
class TestSnippetChooseResults(TestCase, WagtailTestUtils):
|
||||
class TestSnippetChooseResults(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -4664,7 +4664,7 @@ class TestSnippetChooseResults(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestSnippetChooseStatus(TestCase, WagtailTestUtils):
|
||||
class TestSnippetChooseStatus(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -4701,7 +4701,7 @@ class TestSnippetChooseStatus(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestSnippetChooseWithSearchableSnippet(TestCase, WagtailTestUtils):
|
||||
class TestSnippetChooseWithSearchableSnippet(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -4758,7 +4758,7 @@ class TestSnippetChooseWithSearchableSnippet(TestCase, WagtailTestUtils):
|
|||
self.assertIn(self.snippet_c, items)
|
||||
|
||||
|
||||
class TestSnippetChosen(TestCase, WagtailTestUtils):
|
||||
class TestSnippetChosen(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -4781,7 +4781,7 @@ class TestSnippetChosen(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
|
||||
class TestAddOnlyPermissions(TestCase, WagtailTestUtils):
|
||||
class TestAddOnlyPermissions(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -4841,7 +4841,7 @@ class TestAddOnlyPermissions(TestCase, WagtailTestUtils):
|
|||
self.assertRedirects(response, reverse("wagtailadmin_home"))
|
||||
|
||||
|
||||
class TestEditOnlyPermissions(TestCase, WagtailTestUtils):
|
||||
class TestEditOnlyPermissions(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -4901,7 +4901,7 @@ class TestEditOnlyPermissions(TestCase, WagtailTestUtils):
|
|||
self.assertRedirects(response, reverse("wagtailadmin_home"))
|
||||
|
||||
|
||||
class TestDeleteOnlyPermissions(TestCase, WagtailTestUtils):
|
||||
class TestDeleteOnlyPermissions(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -4963,7 +4963,7 @@ class TestDeleteOnlyPermissions(TestCase, WagtailTestUtils):
|
|||
)
|
||||
|
||||
|
||||
class TestSnippetEditHandlers(TestCase, WagtailTestUtils):
|
||||
class TestSnippetEditHandlers(WagtailTestUtils, TestCase):
|
||||
def test_standard_edit_handler(self):
|
||||
edit_handler = get_edit_handler(StandardSnippet)
|
||||
form_class = edit_handler.get_form_class()
|
||||
|
@ -4977,7 +4977,7 @@ class TestSnippetEditHandlers(TestCase, WagtailTestUtils):
|
|||
self.assertTrue(issubclass(form_class, FancySnippetForm))
|
||||
|
||||
|
||||
class TestInlinePanelMedia(TestCase, WagtailTestUtils):
|
||||
class TestInlinePanelMedia(WagtailTestUtils, TestCase):
|
||||
"""
|
||||
Test that form media required by InlinePanels is correctly pulled in to the edit page
|
||||
"""
|
||||
|
@ -5084,7 +5084,7 @@ class TestSnippetChooserBlock(TestCase):
|
|||
self.assertListEqual(list(block.extract_references(None)), [])
|
||||
|
||||
|
||||
class TestAdminSnippetChooserWidget(TestCase, WagtailTestUtils):
|
||||
class TestAdminSnippetChooserWidget(WagtailTestUtils, TestCase):
|
||||
def test_adapt(self):
|
||||
widget = AdminSnippetChooser(Advert)
|
||||
|
||||
|
@ -5098,7 +5098,7 @@ class TestAdminSnippetChooserWidget(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(js_args[1], "__ID__")
|
||||
|
||||
|
||||
class TestSnippetListViewWithCustomPrimaryKey(TestCase, WagtailTestUtils):
|
||||
class TestSnippetListViewWithCustomPrimaryKey(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.login()
|
||||
|
||||
|
@ -5133,7 +5133,7 @@ class TestSnippetListViewWithCustomPrimaryKey(TestCase, WagtailTestUtils):
|
|||
self.assertIn(self.snippet_c, items)
|
||||
|
||||
|
||||
class TestSnippetViewWithCustomPrimaryKey(TestCase, WagtailTestUtils):
|
||||
class TestSnippetViewWithCustomPrimaryKey(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -5345,7 +5345,7 @@ class TestSnippetChooserBlockWithCustomPrimaryKey(TestCase):
|
|||
self.assertIsNone(nonrequired_block.clean(None))
|
||||
|
||||
|
||||
class TestSnippetChooserPanelWithCustomPrimaryKey(TestCase, WagtailTestUtils):
|
||||
class TestSnippetChooserPanelWithCustomPrimaryKey(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -5414,7 +5414,7 @@ class TestSnippetChooserPanelWithCustomPrimaryKey(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(widget.model, AdvertWithCustomPrimaryKey)
|
||||
|
||||
|
||||
class TestSnippetChooseWithCustomPrimaryKey(TestCase, WagtailTestUtils):
|
||||
class TestSnippetChooseWithCustomPrimaryKey(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -5442,7 +5442,7 @@ class TestSnippetChooseWithCustomPrimaryKey(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response.context["items"][0].text, "advert 1")
|
||||
|
||||
|
||||
class TestSnippetChosenWithCustomPrimaryKey(TestCase, WagtailTestUtils):
|
||||
class TestSnippetChosenWithCustomPrimaryKey(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -5463,7 +5463,7 @@ class TestSnippetChosenWithCustomPrimaryKey(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response_json["step"], "chosen")
|
||||
|
||||
|
||||
class TestSnippetChosenWithCustomUUIDPrimaryKey(TestCase, WagtailTestUtils):
|
||||
class TestSnippetChosenWithCustomUUIDPrimaryKey(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
@ -5484,7 +5484,7 @@ class TestSnippetChosenWithCustomUUIDPrimaryKey(TestCase, WagtailTestUtils):
|
|||
self.assertEqual(response_json["step"], "chosen")
|
||||
|
||||
|
||||
class TestPanelConfigurationChecks(TestCase, WagtailTestUtils):
|
||||
class TestPanelConfigurationChecks(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.warning_id = "wagtailadmin.W002"
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
# for testing workflow operations through views and testing Workflow settings views
|
||||
|
||||
|
||||
class BaseWorkflowsTestCase(TestCase, WagtailTestUtils):
|
||||
class BaseWorkflowsTestCase(WagtailTestUtils, TestCase):
|
||||
model = FullFeaturedSnippet
|
||||
|
||||
def setUp(self):
|
||||
|
|
|
@ -13,7 +13,7 @@ from .fields import ConvertedValue, ConvertedValueField
|
|||
@unittest.skipUnless(
|
||||
settings.AUTH_USER_MODEL == "customuser.CustomUser", "Only applicable to CustomUser"
|
||||
)
|
||||
class TestConvertedValueField(TestCase, WagtailTestUtils):
|
||||
class TestConvertedValueField(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.login()
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ from wagtail.test.testapp.models import FullFeaturedSnippet, SimplePage
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestAuditLogManager(TestCase, WagtailTestUtils):
|
||||
class TestAuditLogManager(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.user = self.create_superuser(
|
||||
username="administrator",
|
||||
|
@ -501,7 +501,7 @@ def test_hook(actions):
|
|||
return actions.register_action("test.custom_action", "Custom action", "Tested!")
|
||||
|
||||
|
||||
class TestAuditLogHooks(TestCase, WagtailTestUtils):
|
||||
class TestAuditLogHooks(WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
self.root_page = Page.objects.get(id=2)
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ from wagtail.test.utils import WagtailTestUtils
|
|||
from wagtail.tests.test_permission_policies import PermissionPolicyTestUtils
|
||||
|
||||
|
||||
class PermissionPolicyTestCase(PermissionPolicyTestUtils, TestCase, WagtailTestUtils):
|
||||
class PermissionPolicyTestCase(PermissionPolicyTestUtils, WagtailTestUtils, TestCase):
|
||||
def setUp(self):
|
||||
# Permissions
|
||||
document_content_type = ContentType.objects.get_for_model(Document)
|
||||
|
@ -1042,7 +1042,7 @@ class TestCollectionOwnershipPermissionPolicy(PermissionPolicyTestCase):
|
|||
|
||||
|
||||
class TestCollectionManagementPermission(
|
||||
PermissionPolicyTestUtils, TestCase, WagtailTestUtils
|
||||
PermissionPolicyTestUtils, WagtailTestUtils, TestCase
|
||||
):
|
||||
def setUp(self):
|
||||
self.policy = CollectionMangementPermissionPolicy(Collection)
|
||||
|
|
|
@ -8,7 +8,7 @@ def test_hook():
|
|||
pass
|
||||
|
||||
|
||||
class TestLoginView(TestCase, WagtailTestUtils):
|
||||
class TestLoginView(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
@classmethod
|
||||
|
|
|
@ -2791,7 +2791,7 @@ class TestCopyForTranslation(TestCase):
|
|||
self.assertEqual(fr_eventindex.alias_of, self.en_eventindex)
|
||||
|
||||
|
||||
class TestSubpageTypeBusinessRules(TestCase, WagtailTestUtils):
|
||||
class TestSubpageTypeBusinessRules(WagtailTestUtils, TestCase):
|
||||
def test_allowed_subpage_models(self):
|
||||
# SimplePage does not define any restrictions on subpage types
|
||||
# SimplePage is a valid subpage of SimplePage
|
||||
|
|
|
@ -5,7 +5,7 @@ from wagtail.models import Page, PageViewRestriction
|
|||
from wagtail.test.utils import WagtailTestUtils
|
||||
|
||||
|
||||
class TestPagePrivacy(TestCase, WagtailTestUtils):
|
||||
class TestPagePrivacy(WagtailTestUtils, TestCase):
|
||||
fixtures = ["test.json"]
|
||||
|
||||
def setUp(self):
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Ładowanie…
Reference in New Issue