Products.CMFPlone/plip-1486-redirection: Add tests for missing slashes in redirections

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/93d0af2b061592cc4d5a0ffeac41ad01d96c00f5

Add tests for missing slashes in redirections

Files changed:
M 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
index cba5f7857..1bc765fc1 100644
--- a/Products/CMFPlone/controlpanel/tests/test_controlpanel_browser_redirection.py
+++ b/Products/CMFPlone/controlpanel/tests/test_controlpanel_browser_redirection.py
@@ -202,3 +202,38 @@ def test_redirection_controlpanel_redirect_no_target(self):
             'The provided target object does not exist.' in self.browser.contents,
             u'Message "target does not exist" not in page!'
         )
+
+    def test_redirection_controlpanel_missing_slash_target(self):
+        path_alias = '/alias'
+        path_target = 'Members'
+
+        self.browser.open(
+            "%s/@@redirection-controlpanel" % self.portal_url)
+        self.browser.getControl(
+            name='redirection').value = path_alias
+        self.browser.getControl(
+            name='target_path').value = path_target
+        self.browser.getControl(name='form.button.Add').click()
+
+        self.assertTrue(
+            'Target path must start with a slash.' in self.browser.contents,
+            u'Errormessage for missing slash on target path missing'
+        )
+
+
+    def test_redirection_controlpanel_missing_slash_alias(self):
+        path_alias = 'alias'
+        path_target = '/Members'
+
+        self.browser.open(
+            "%s/@@redirection-controlpanel" % self.portal_url)
+        self.browser.getControl(
+            name='redirection').value = path_alias
+        self.browser.getControl(
+            name='target_path').value = path_target
+        self.browser.getControl(name='form.button.Add').click()
+
+        self.assertTrue(
+            'Alias path must start with a slash.' in self.browser.contents,
+            u'Errormessage for missing slash on alias path missing'
+        )



------------------------------------------------------------------------------
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.