Test copy relations
This commit is contained in:
parent
e5b3de7ef4
commit
90ed83c821
1 changed files with 48 additions and 0 deletions
|
@ -59,6 +59,24 @@ class PluginTest(BaseTest):
|
|||
self.assertTrue(rendered.find('<article id="post-second-post"') > -1)
|
||||
self.assertTrue(rendered.find(posts[1].get_absolute_url()) > -1)
|
||||
|
||||
# Checking copy relations
|
||||
ph = pages[0].placeholders.get(slot='content')
|
||||
original = ph.get_plugins('en')
|
||||
pages[0].publish('en')
|
||||
published = pages[0].get_public_object()
|
||||
ph = published.placeholders.get(slot='content')
|
||||
new = ph.get_plugins('en')
|
||||
self.assertNotEqual(original, new)
|
||||
|
||||
casted_tags, __ = new[0].get_plugin_instance()
|
||||
casted_categories, __ = new[1].get_plugin_instance()
|
||||
|
||||
self.assertEqual(casted_tags.tags.count(), 1)
|
||||
self.assertEqual(casted_tags.categories.count(), 0)
|
||||
|
||||
self.assertEqual(casted_categories.tags.count(), 0)
|
||||
self.assertEqual(casted_categories.categories.count(), 1)
|
||||
|
||||
def test_plugin_authors(self):
|
||||
pages = self.get_pages()
|
||||
posts = self.get_posts()
|
||||
|
@ -73,6 +91,36 @@ class PluginTest(BaseTest):
|
|||
rendered = plugin.render_plugin(context, ph)
|
||||
self.assertTrue(rendered.find('No article found') > -1)
|
||||
|
||||
plugin.authors.add(self.user)
|
||||
context = self.get_plugin_context(pages[0], 'en', plugin, edit=True)
|
||||
rendered = plugin.render_plugin(context, ph)
|
||||
self.assertTrue(rendered.find('/en/blog/author/admin/') > -1)
|
||||
self.assertTrue(rendered.find('2 articles') > -1)
|
||||
|
||||
plugin.authors.add(self.user_staff)
|
||||
context = self.get_plugin_context(pages[0], 'en', plugin, edit=True)
|
||||
rendered = plugin.render_plugin(context, ph)
|
||||
self.assertTrue(rendered.find('/en/blog/author/staff/') > -1)
|
||||
self.assertTrue(rendered.find('0 articles') > -1)
|
||||
|
||||
plugin.authors.add(self.user_normal)
|
||||
context = self.get_plugin_context(pages[0], 'en', plugin, edit=True)
|
||||
rendered = plugin.render_plugin(context, ph)
|
||||
self.assertTrue(rendered.find('/en/blog/author/normal/') > -1)
|
||||
self.assertTrue(rendered.find('0 articles') > -1)
|
||||
|
||||
# Checking copy relations
|
||||
ph = pages[0].placeholders.get(slot='content')
|
||||
original = ph.get_plugins('en')
|
||||
pages[0].publish('en')
|
||||
published = pages[0].get_public_object()
|
||||
ph = published.placeholders.get(slot='content')
|
||||
new = ph.get_plugins('en')
|
||||
self.assertNotEqual(original, new)
|
||||
|
||||
casted_authors, __ = new[0].get_plugin_instance()
|
||||
self.assertEqual(casted_authors.authors.count(), 3)
|
||||
|
||||
def test_plugin_tags(self):
|
||||
pages = self.get_pages()
|
||||
posts = self.get_posts()
|
||||
|
|
Loading…
Reference in a new issue