Skip to content

Commit

Permalink
Remove obsolete compat code
Browse files Browse the repository at this point in the history
  • Loading branch information
Stormheg committed Sep 17, 2024
1 parent 3004b93 commit e0790ae
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 42 deletions.
12 changes: 3 additions & 9 deletions wagtail_ab_testing/test/tests/test_add_abtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django.urls import reverse
from wagtail import VERSION as WAGTAIL_VERSION
from wagtail.models import Page
from wagtail.test.utils import WagtailTestUtils

Expand Down Expand Up @@ -259,14 +258,9 @@ def test_post_add_form_start(self):
self.assertEqual(ab_test.status, AbTest.STATUS_RUNNING)

def test_post_add_form_start_without_publish_permission(self):
if WAGTAIL_VERSION >= (5, 1):
self.moderators_group.page_permissions.filter(
permission__codename="publish_page"
).delete()
else:
self.moderators_group.page_permissions.filter(
permission_type="publish"
).delete()
self.moderators_group.page_permissions.filter(
permission__codename="publish_page"
).delete()

response = self.client.post(
reverse("wagtail_ab_testing_admin:add_ab_test_form", args=[self.page.id]),
Expand Down
45 changes: 12 additions & 33 deletions wagtail_ab_testing/test/tests/test_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from django.contrib.contenttypes.models import ContentType
from django.test import TestCase
from django.urls import reverse
from wagtail import VERSION as WAGTAIL_VERSION
from wagtail.models import Page
from wagtail.test.utils import WagtailTestUtils

Expand Down Expand Up @@ -122,14 +121,9 @@ def test_post_end(self):
self.assertEqual(self.ab_test.status, AbTest.STATUS_CANCELLED)

def test_post_start_without_publish_permission(self):
if WAGTAIL_VERSION >= (5, 1):
self.moderators_group.page_permissions.filter(
permission__codename="publish_page"
).delete()
else:
self.moderators_group.page_permissions.filter(
permission_type="publish"
).delete()
self.moderators_group.page_permissions.filter(
permission__codename="publish_page"
).delete()

self.ab_test.status = AbTest.STATUS_DRAFT
self.ab_test.save()
Expand All @@ -150,14 +144,9 @@ def test_post_start_without_publish_permission(self):
self.assertEqual(self.ab_test.status, AbTest.STATUS_DRAFT)

def test_post_pause_without_publish_permission(self):
if WAGTAIL_VERSION >= (5, 1):
self.moderators_group.page_permissions.filter(
permission__codename="publish_page"
).delete()
else:
self.moderators_group.page_permissions.filter(
permission_type="publish"
).delete()
self.moderators_group.page_permissions.filter(
permission__codename="publish_page"
).delete()

response = self.client.post(
reverse("wagtailadmin_pages:edit", args=[self.page.id]),
Expand All @@ -175,14 +164,9 @@ def test_post_pause_without_publish_permission(self):
self.assertEqual(self.ab_test.status, AbTest.STATUS_RUNNING)

def test_post_restart_without_publish_permission(self):
if WAGTAIL_VERSION >= (5, 1):
self.moderators_group.page_permissions.filter(
permission__codename="publish_page"
).delete()
else:
self.moderators_group.page_permissions.filter(
permission_type="publish"
).delete()
self.moderators_group.page_permissions.filter(
permission__codename="publish_page"
).delete()

self.ab_test.status = AbTest.STATUS_PAUSED
self.ab_test.save()
Expand All @@ -202,14 +186,9 @@ def test_post_restart_without_publish_permission(self):
self.assertEqual(self.ab_test.status, AbTest.STATUS_PAUSED)

def test_post_end_without_publish_permission(self):
if WAGTAIL_VERSION >= (5, 1):
self.moderators_group.page_permissions.filter(
permission__codename="publish_page"
).delete()
else:
self.moderators_group.page_permissions.filter(
permission_type="publish"
).delete()
self.moderators_group.page_permissions.filter(
permission__codename="publish_page"
).delete()

response = self.client.post(
reverse("wagtailadmin_pages:edit", args=[self.page.id]),
Expand Down

0 comments on commit e0790ae

Please sign in to comment.