Esempio n. 1
0
 def test_is_current_deleted_page(self):
     node = NodeFactory()
     ver = NodeWikiPage(page_name='foo', node=node)
     ver.save()
     # Simulate a deleted page by not adding ver to
     # node.wiki_pages_current and node.wiki_pages_versions
     assert ver.is_current is False
Esempio n. 2
0
 def test_is_current_deleted_page(self):
     node = NodeFactory()
     ver = NodeWikiPage(page_name='foo', node=node)
     ver.save()
     # Simulate a deleted page by not adding ver to
     # node.wiki_pages_current and node.wiki_pages_versions
     assert ver.is_current is False
Esempio n. 3
0
 def test_is_current_with_single_version(self):
     node = NodeFactory()
     page = NodeWikiPage(page_name='foo', node=node)
     page.save()
     node.wiki_pages_current['foo'] = page._id
     node.wiki_pages_versions['foo'] = [page._id]
     node.save()
     assert page.is_current is True
Esempio n. 4
0
 def test_is_current_with_single_version(self):
     node = NodeFactory()
     page = NodeWikiPage(page_name='foo', node=node)
     page.save()
     node.wiki_pages_current['foo'] = page._id
     node.wiki_pages_versions['foo'] = [page._id]
     node.save()
     assert page.is_current is True
Esempio n. 5
0
 def test_is_current_with_multiple_versions(self):
     node = NodeFactory()
     ver1 = NodeWikiPage(page_name='foo', node=node)
     ver2 = NodeWikiPage(page_name='foo', node=node)
     ver1.save()
     ver2.save()
     node.wiki_pages_current['foo'] = ver2._id
     node.wiki_pages_versions['foo'] = [ver1._id, ver2._id]
     node.save()
     assert ver1.is_current is False
     assert ver2.is_current is True
Esempio n. 6
0
 def test_is_current_with_multiple_versions(self):
     node = NodeFactory()
     ver1 = NodeWikiPage(page_name='foo', node=node)
     ver2 = NodeWikiPage(page_name='foo', node=node)
     ver1.save()
     ver2.save()
     node.wiki_pages_current['foo'] = ver2._id
     node.wiki_pages_versions['foo'] = [ver1._id, ver2._id]
     node.save()
     assert ver1.is_current is False
     assert ver2.is_current is True
Esempio n. 7
0
 def test_page_name_cannot_be_greater_than_100_characters(self):
     bad_name = 'a' * 101
     page = NodeWikiPage(page_name=bad_name)
     with pytest.raises(ValidationValueError):
         page.save()
Esempio n. 8
0
 def test_page_name_cannot_be_greater_than_100_characters(self):
     bad_name = 'a' * 101
     page = NodeWikiPage(page_name=bad_name)
     with pytest.raises(NameMaximumLengthError):
         page.save()
Esempio n. 9
0
 def test_page_name_cannot_be_greater_than_100_characters(self):
     bad_name = 'a' * 101
     page = NodeWikiPage(page_name=bad_name)
     with pytest.raises(NameMaximumLengthError):
         page.save()
Esempio n. 10
0
 def test_page_name_cannot_be_greater_than_100_characters(self):
     bad_name = 'a' * 101
     page = NodeWikiPage(page_name=bad_name)
     with pytest.raises(ValidationValueError):
         page.save()