[Erp5-report] r35502 fabien - /erp5/trunk/products/ERP5/tests/testERP5Web.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu May 20 17:59:44 CEST 2010


Author: fabien
Date: Thu May 20 17:59:43 2010
New Revision: 35502

URL: http://svn.erp5.org?rev=35502&view=rev
Log:
add a test for 404 error pages

Modified:
    erp5/trunk/products/ERP5/tests/testERP5Web.py

Modified: erp5/trunk/products/ERP5/tests/testERP5Web.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testERP5Web.py?rev=35502&r1=35501&r2=35502&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testERP5Web.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testERP5Web.py [utf8] Thu May 20 17:59:43 2010
@@ -1220,6 +1220,29 @@
     modification_date = rfc1123_date(document.getModificationDate())
     self.assertEqual(modification_date, last_modified_header)
 
+  def test_16_404ErrorPageIsReturned(self, quiet=quiet, run=run_all_test):
+    """
+      Test that when we try to access a non existing url trought a web site, a
+      404 error page is returned
+    """
+    if not run: return
+    if not quiet:
+      message = '\ntest_16_404ErrorPageIsReturned'
+      ZopeTestCase._print(message)
+
+    portal = self.getPortal()
+    request = portal.REQUEST
+    request['PARENTS'] = [self.app]
+    website = self.setupWebSite()
+    path = website.absolute_url_path() + '/a_non_existing_page'
+    absolute_url = website.absolute_url() + '/a_non_existing_page'
+    request = portal.REQUEST
+
+    # Check a Not Found page is returned
+    self.assertTrue('Not Found' in request.traverse(path)())
+    # Check that we try to display a page with 404.error.page reference
+    self.assertEqual(request.traverse(path).absolute_url().split('/')[-1],
+    '404.error.page')
 
 class TestERP5WebWithSimpleSecurity(ERP5TypeTestCase):
   """




More information about the Erp5-report mailing list