8

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

@@ -52,3 +52,11 @@ def test_canonical_page_deletion_is_protected(segmented_page):
# an error. All variants should be deleted beforehand.
with pytest.raises(ProtectedError):
segmented_page.personalisation_metadata.canonical_page.delete()
@pytest.mark.django_db
def test_page_protection_when_deleting_segment(segmented_page):
segment = segmented_page.personalisation_metadata.segment
assert len(segment.get_used_pages())
with pytest.raises(ProtectedError):
segment.delete()