Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added test for covering 'edit plugin' history navigation

  • Loading branch information...
commit 6fec447dafbc6b32f21fb029ab09e88e8665dd29 1 parent 5e1fa57
@kux authored
Showing with 29 additions and 1 deletion.
  1. +3 −0  cms/test_utils/testcases.py
  2. +26 −1 cms/tests/plugins.py
View
3  cms/test_utils/testcases.py
@@ -25,6 +25,9 @@
URL_CMS_PLUGIN_REMOVE = urljoin(URL_CMS_PAGE_CHANGE, "remove-plugin/")
URL_CMS_TRANSLATION_DELETE = urljoin(URL_CMS_PAGE_CHANGE, "delete-translation/")
+URL_CMS_PAGE_HISTORY = urljoin(URL_CMS_PAGE_CHANGE, "history/%d/")
+URL_CMS_PLUGIN_HISTORY_EDIT = urljoin(URL_CMS_PAGE_HISTORY, "edit-plugin/")
+
class _Warning(object):
def __init__(self, message, category, filename, lineno):
View
27 cms/tests/plugins.py
@@ -19,7 +19,7 @@
from cms.test_utils.project.pluginapp.plugins.manytomany_rel.models import (
ArticlePluginModel)
from cms.test_utils.testcases import (CMSTestCase, URL_CMS_PAGE,
- URL_CMS_PAGE_ADD, URL_CMS_PLUGIN_ADD, URL_CMS_PLUGIN_EDIT, URL_CMS_PAGE_CHANGE, URL_CMS_PLUGIN_REMOVE)
+ URL_CMS_PAGE_ADD, URL_CMS_PLUGIN_ADD, URL_CMS_PLUGIN_EDIT, URL_CMS_PAGE_CHANGE, URL_CMS_PLUGIN_REMOVE, URL_CMS_PLUGIN_HISTORY_EDIT)
from cms.sitemaps.cms_sitemap import CMSSitemap
from cms.test_utils.util.context_managers import SettingsOverride
from cms.utils.copy_plugins import copy_plugins_to
@@ -125,6 +125,31 @@ def test_add_edit_plugin(self):
txt = Text.objects.all()[0]
self.assertEquals("Hello World", txt.body)
+ def test_plugin_history_view(self):
+ """
+ Test plugin history view
+ """
+ from reversion.models import Version
+ page_data = self.get_new_page_data()
+ # two versions created by simply creating the page
+ response = self.client.post(URL_CMS_PAGE_ADD, page_data)
+ page = Page.objects.all()[0]
+ page_id = int(page.pk)
+ # page version 3
+ created_plugin_id = self._create_text_plugin_on_page(page)
+ # page version 4
+ txt = self._edit_text_plugin(created_plugin_id, "Hello Foo")
+ self.assertEquals("Hello Foo", txt.body)
+ # page version 5
+ txt = self._edit_text_plugin(created_plugin_id, "Hello Bar")
+ self.assertEquals("Hello Bar", txt.body)
+ versions = [v.pk for v in Version.objects.get_for_object(page)]
+ history_url = '%s%d/' % (
+ URL_CMS_PLUGIN_HISTORY_EDIT % (page_id, versions[-2]),
+ created_plugin_id)
+ response = self.client.get(history_url)
+ self.assertEquals(response.status_code, 200)
+ self.assertIn('Hello Foo', response.content)
def test_plugin_order(self):
"""

0 comments on commit 6fec447

Please sign in to comment.
Something went wrong with that request. Please try again.