Example #1
0
def test_delete_same_slug_different_services(root_page):
    page_one = IndustryPageFactory(slug='foo', parent=root_page)
    page_two = SectorPageFactory(slug='foo', parent=root_page)
    assert page_one.slug == 'foo'
    assert page_two.slug == 'foo'
    page_one.delete()
    assert Page.objects.filter(pk=page_one.pk).exists() is False
Example #2
0
def test_delete_same_slug_different_services(root_page):
    """
    Deleting a page results in ancestor pages being re-saved.
    Thus ancestor page (root_page) has to have title & title_en_gb.
    """
    root_page.title = 'ancestor page has to have a title'
    root_page.title_en_gb = 'ancestor page has to have a title'
    root_page.save()
    page_one = IndustryPageFactory(slug='foo', parent=root_page)
    page_two = SectorPageFactory(slug='foo', parent=root_page)
    assert page_one.slug == 'foo'
    assert page_two.slug == 'foo'
    page_one.delete()
    assert Page.objects.filter(pk=page_one.pk).exists() is False