7

Delete related variants when deleting the segment (#183)

* Delete related variants when deleting the segment

Closes #155

* Fix typo

* Fix migration ordering

* Split metadata migrations
This commit is contained in:
tm-kn
2018-07-19 11:59:46 +01:00
committed by Jasper Berghoef
parent e42e1a865b
commit a47803eca5
10 changed files with 216 additions and 12 deletions

View File

@ -1,7 +1,8 @@
import pytest
from tests.factories.page import ContentPageFactory
from wagtail_personalisation.utils import impersonate_other_page
from wagtail_personalisation.utils import (
can_delete_pages, impersonate_other_page)
@pytest.fixture
@ -24,3 +25,14 @@ def test_impersonate_other_page(page, otherpage):
impersonate_other_page(page, otherpage)
assert page.title == otherpage.title == 'Bye'
assert page.path == otherpage.path
@pytest.mark.django_db
def test_can_delete_pages_with_superuser(rf, user, segmented_page):
user.is_superuser = True
assert can_delete_pages([segmented_page], user)
@pytest.mark.django_db
def test_cannot_delete_pages_with_standard_user(user, segmented_page):
assert not can_delete_pages([segmented_page], user)