def test_is_current_with_single_version(self): user = UserFactory() node = NodeFactory() page = WikiPage(page_name='foo', node=node) page.save() version = page.create_version(user=user, content='hello') assert version.is_current is True
def test_is_current_deleted_page(self): user = UserFactory() node = NodeFactory() page = WikiPage(page_name='foo', node=node) page.save() ver1 = page.create_version(user=user, content='draft1') page.deleted = datetime.datetime(2017, 1, 1, 1, 00, tzinfo=pytz.utc) page.save() assert ver1.is_current is False
def test_is_current_with_multiple_versions(self): user = UserFactory() node = NodeFactory() page = WikiPage(page_name='foo', node=node) page.save() ver1 = page.create_version(user=user, content='draft1') ver2 = page.create_version(user=user, content='draft2') assert ver1.is_current is False assert ver2.is_current is True
def test_page_name_cannot_be_greater_than_100_characters(self): bad_name = 'a' * 101 page = WikiPage(page_name=bad_name) with pytest.raises(NameMaximumLengthError): page.save()