Products.CMFPlone/plip-1486-redirection: Add test for not existing target

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/17c3b0ea0c3a248fdf02d3e979904dca50203344

Add test for not existing target

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 1dc129808..cba5f7857 100644
--- a/Products/CMFPlone/controlpanel/tests/test_controlpanel_browser_redirection.py
+++ b/Products/CMFPlone/controlpanel/tests/test_controlpanel_browser_redirection.py
@@ -185,3 +185,20 @@ def test_redirection_controlpanel_filtering(self):
         # Filtering without new request does not have effect because memoize
         request.form['q'] = '/foo2'
         self.assertEqual(view.redirects().numpages, math.ceil(2000 / 15.))
+
+    def test_redirection_controlpanel_redirect_no_target(self):
+        path_alias = '/alias'
+        path_target = '/not-existing'
+
+        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(
+            'The provided target object does not exist.' in self.browser.contents,
+            u'Message "target does not exist" not in page!'
+        )



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