Products.CMFPlone/plip-1486-redirection: Add test for the redirection control panel

Stephan Klinger <jenkins-z4DKO/[email protected]>
Newsgroups gmane.comp.web.zope.plone.cvs
Message-ID <[email protected]>
Repository: Products.CMFPlone
Branch: refs/heads/plip-1486-redirection
Date: 2017-07-10T09:31:40+03:00
Author: Stephan Klinger (staeff) <[email protected]>
Commit: https://github.com/plone/Products.CMFPlone/commit/f4537401b41ee476bbb7a5bb7466fb76f63af883

Add test for the redirection control panel

Files changed:
A Products/CMFPlone/controlpanel/tests/test_controlpanel_browser_redirection.py

diff --git a/Products/CMFPlone/controlpanel/tests/test_controlpanel_browser_redirection.py b/Products/CMFPlone/controlpanel/tests/test_controlpanel_browser_redirection.py
new file mode 100644
index 000000000..ffd2418b3
--- /dev/null
+++ b/Products/CMFPlone/controlpanel/tests/test_controlpanel_browser_redirection.py
@@ -0,0 +1,56 @@
+# -*- coding: utf-8 -*-
+from plone.app.testing import SITE_OWNER_NAME, SITE_OWNER_PASSWORD
+from plone.registry.interfaces import IRegistry
+from plone.testing.z2 import Browser
+
+from zope.component import getMultiAdapter
+from zope.component import getUtility
+
+from Products.CMFPlone.testing import \
+    PRODUCTS_CMFPLONE_FUNCTIONAL_TESTING
+
+import unittest
+
+
+class RedirectionControlPanelFunctionalTest(unittest.TestCase):
+    """Test that changes in the mail control panel are actually
+    stored in the registry.
+    """
+
+    layer = PRODUCTS_CMFPLONE_FUNCTIONAL_TESTING
+
+    def setUp(self):
+        self.app = self.layer['app']
+        self.portal = self.layer['portal']
+        self.portal_url = self.portal.absolute_url()
+        self.browser = Browser(self.app)
+        self.browser.handleErrors = False
+        self.browser.addHeader(
+            'Authorization',
+            'Basic %s:%s' % (SITE_OWNER_NAME, SITE_OWNER_PASSWORD,)
+        )
+
+    """
+    def test_mail_controlpanel_link(self):
+        self.browser.open(
+            "%s/@@overview-controlpanel" % self.portal_url)
+        self.browser.getLink('Mail').click()
+
+    def test_mail_controlpanel_backlink(self):
+        self.browser.open(
+            "%s/@@mail-controlpanel" % self.portal_url)
+        self.assertTrue("General" in self.browser.contents)
+
+    def test_mail_controlpanel_sidebar(self):
+        self.browser.open(
+            "%s/@@mail-controlpanel" % self.portal_url)
+        self.browser.getLink('Site Setup').click()
+        self.assertTrue(
+            self.browser.url.endswith('/plone/@@overview-controlpanel')
+        )
+    """
+
+    def test_redirection_controlpanel_view(self):
+        view = getMultiAdapter((self.portal, self.portal.REQUEST),
+                               name="redirection-controlpanel")
+        self.assertTrue(view())



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.