[Erp5-report] r43785 kazuhiko - /erp5/trunk/products/ERP5Security/tests/testERP5Security.py

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Feb 25 21:20:31 CET 2011


Author: kazuhiko
Date: Fri Feb 25 21:20:31 2011
New Revision: 43785

URL: http://svn.erp5.org?rev=43785&view=rev
Log:
check if key authentication works for non front page and web mode.
# this test fails for now.

Modified:
    erp5/trunk/products/ERP5Security/tests/testERP5Security.py

Modified: erp5/trunk/products/ERP5Security/tests/testERP5Security.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Security/tests/testERP5Security.py?rev=43785&r1=43784&r2=43785&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Security/tests/testERP5Security.py [utf8] (original)
+++ erp5/trunk/products/ERP5Security/tests/testERP5Security.py [utf8] Fri Feb 25 21:20:31 2011
@@ -51,7 +51,7 @@ class TestUserManagement(ERP5TypeTestCas
 
   def getBusinessTemplateList(self):
     """List of BT to install. """
-    return ('erp5_base',)
+    return ('erp5_base', 'erp5_web',)
 
   def beforeTearDown(self):
     """Clears person module and invalidate caches when tests are finished."""
@@ -721,6 +721,28 @@ class TestLocalRoleManagement(ERP5TypeTe
     self.assertEqual(response.getStatus(), 200)
     self.assertTrue(reference in response.getBody())
 
+    # check if key authentication works other page than front page
+    person_module = portal.person_module
+    base_url = person_module.absolute_url(relative=1)
+    response = self.publish(base_url)
+    self.assertEqual(response.getStatus(), 302)
+    self.assertTrue('location' in response.headers.keys())
+    self.assertTrue('%s/login_form?came_from=' % portal.getId(), response.headers['location'])
+    response = self.publish('%s?__ac_key=%s' %(base_url, key))
+    self.assertEqual(response.getStatus(), 200)
+    self.assertTrue(reference in response.getBody())
+
+    # check if key authentication works with web_mode too
+    web_site = portal.web_site_module.newContent(portal_type='Web Site')
+    base_url = web_site.absolute_url(relative=1)
+    response = self.publish(base_url)
+    self.assertEqual(response.getStatus(), 302)
+    self.assertTrue('location' in response.headers.keys())
+    self.assertTrue('%s/login_form?came_from=' % portal.getId(), response.headers['location'])
+    response = self.publish('%s?__ac_key=%s' %(base_url, key))
+    self.assertEqual(response.getStatus(), 200)
+    self.assertTrue(reference in response.getBody())
+
   def testERP5ExternalAuthenticationPlugin(self):
     """
      Make sure that we can grant security using a ERP5 External Authentication Plugin.



More information about the Erp5-report mailing list