[Checkins] SVN: z3c.layer.pagelet/trunk/ - Added a test for ``403 Forbidden``.

Michael Howitz mh at gocept.com
Mon Oct 11 05:23:55 EDT 2010


Log message for revision 117426:
  - Added a test for ``403 Forbidden``.
  
  

Changed:
  U   z3c.layer.pagelet/trunk/CHANGES.txt
  U   z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/README.txt
  U   z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/tests/ftesting.zcml

-=-
Modified: z3c.layer.pagelet/trunk/CHANGES.txt
===================================================================
--- z3c.layer.pagelet/trunk/CHANGES.txt	2010-10-11 09:15:42 UTC (rev 117425)
+++ z3c.layer.pagelet/trunk/CHANGES.txt	2010-10-11 09:23:54 UTC (rev 117426)
@@ -10,6 +10,7 @@
 
 - Got rid of `zope.app.testing` test dependency by using `zope.app.wsgi`.
 
+- Added a test for ``403 Forbidden``.
 
 1.8.0 (2010-08-20)
 ------------------

Modified: z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/README.txt
===================================================================
--- z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/README.txt	2010-10-11 09:15:42 UTC (rev 117425)
+++ z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/README.txt	2010-10-11 09:23:54 UTC (rev 117426)
@@ -182,7 +182,6 @@
   >>> unauthorized = Browser()
   >>> unauthorized.open(skinURL + '/@@forbidden.html')
   Traceback (most recent call last):
-  ...
   HTTPError: HTTP Error 401: Unauthorized
 
   >>> print unauthorized.contents
@@ -199,7 +198,36 @@
     <br />
     <b>You are not authorized.</b>
   </div>
-  <BLANKLINE>
   </body>
   </html>
-  <BLANKLINE>
+
+Forbidden
+~~~~~~~~~
+
+When an authorized user tries to access a URL where he does not have enough
+permissions he gets a ``403 Forbidden``, the displayed page contents are the
+same like ``401 Unauthorized``. When an authentication utility is registered
+it might display a log-in form:
+
+  >>> authorized = Browser()
+  >>> authorized.addHeader('Authorization', 'Basic tester:tester')
+  >>> authorized.open(skinURL + '/@@forbidden.html')
+  Traceback (most recent call last):
+  HTTPError: HTTP Error 403: Forbidden
+
+  >>> print authorized.contents
+    <!DOCTYPE ...
+    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+    <head>
+    <title>PageletTestLayout</title>
+    </head>
+    <body>
+      <div>
+      <br />
+      <br />
+      <h3>Unauthorized</h3>
+      <br />
+      <b>You are not authorized.</b>
+    </div>
+    </body>
+    </html>

Modified: z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/tests/ftesting.zcml
===================================================================
--- z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/tests/ftesting.zcml	2010-10-11 09:15:42 UTC (rev 117425)
+++ z3c.layer.pagelet/trunk/src/z3c/layer/pagelet/tests/ftesting.zcml	2010-10-11 09:23:54 UTC (rev 117426)
@@ -155,4 +155,11 @@
 
   <grantAll principal="zope.manager" />
 
+  <principal
+      id="zope.tester"
+      title="Tester"
+      login="tester"
+      password="tester"
+      />
+
 </configure>



More information about the checkins mailing list