8

Fix tests

This commit is contained in:
nick.moreton
2022-11-18 16:44:42 +00:00
parent 5642e117f1
commit e31793e748
8 changed files with 41 additions and 24 deletions

View File

@@ -2,6 +2,7 @@ import datetime
import pytest
from django.db.models import ProtectedError
from wagtail import VERSION as WAGTAIL_VERSION
from tests.factories.page import ContentPageFactory
from tests.factories.segment import SegmentFactory
@@ -76,8 +77,8 @@ def test_sitemap_generation_for_variants_is_disabled(segmented_page):
@pytest.mark.django_db
def test_segment_edit_view(site, client, django_user_model):
test_segment = SegmentFactory()
try:
new_panel = test_segment.panels[1].children[0].bind_to(model=Segment)
except AttributeError:
if WAGTAIL_VERSION >= (3, 0):
new_panel = test_segment.panels[1].children[0].bind_to_model(Segment)
else:
new_panel = test_segment.panels[1].children[0].bind_to(model=Segment)
assert new_panel.related.name == "wagtail_personalisation_timerules"