Products.CMFPlone/plip-1486-redirection: Add test for adding a redirect in 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/ef7a122d110016a6060589d12e0b1f5f431e97a3 Add test for adding a redirect in control panel 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 ffd2418b3..8d2cdceda 100644 --- a/Products/CMFPlone/controlpanel/tests/test_controlpanel_browser_redirection.py +++ b/Products/CMFPlone/controlpanel/tests/test_controlpanel_browser_redirection.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- from plone.app.testing import SITE_OWNER_NAME, SITE_OWNER_PASSWORD -from plone.registry.interfaces import IRegistry +from plone.app.redirector.interfaces import IRedirectionStorage from plone.testing.z2 import Browser from zope.component import getMultiAdapter @@ -54,3 +54,23 @@ def test_redirection_controlpanel_view(self): view = getMultiAdapter((self.portal, self.portal.REQUEST), name="redirection-controlpanel") self.assertTrue(view()) + + def test_redirection_controlpanel_add_redirect(self): + + redirection_path = '/Member1' + target_path = '/Member' + storage_path = '/plone/Member1' + + self.browser.open( + "%s/@@redirection-controlpanel" % self.portal_url) + self.browser.getControl( + name='redirection').value = redirection_path + self.browser.getControl( + name='target_path').value = target_path + self.browser.getControl(name='form.button.Add').click() + + storage = getUtility(IRedirectionStorage) + self.assertTrue( + storage.has_path(storage_path), + u'Redirection storage should have path "{0}"'.format(storage_path) + ) \ No newline at end of file ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot