8
This repository has been archived on 2023-05-07. You can view files and clone it, but cannot push or open issues or pull requests.
Files
cavemanon-wagtail-personali…/tests/unit/test_utils.py
Paul J Stevens 4f3f9a4d40 lint
2018-05-26 12:28:01 +02:00

27 lines
675 B
Python

import pytest
from tests.factories.page import ContentPageFactory
from wagtail_personalisation.utils import impersonate_other_page
@pytest.fixture
def rootpage():
return ContentPageFactory(parent=None, path='/', depth=0, title='root')
@pytest.fixture
def page(rootpage):
return ContentPageFactory(parent=rootpage, path='/hi', title='Hi')
@pytest.fixture
def otherpage(rootpage):
return ContentPageFactory(parent=rootpage, path='/bye', title='Bye')
@pytest.mark.django_db
def test_impersonate_other_page(page, otherpage):
impersonate_other_page(page, otherpage)
assert page.title == otherpage.title == 'Bye'
assert page.path == otherpage.path