Skip to content

Commit

Permalink
demonstrate the traversal exception view will handle NotFound errors too
Browse files Browse the repository at this point in the history
  • Loading branch information
janwijbrand committed Jan 19, 2011
1 parent 5fdfe4c commit 690f5d7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/zope/errorview/tests/test_http.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from zope.publisher.http import HTTPRequest
from zope.publisher.interfaces.http import IHTTPException, IHTTPRequest
from zope.publisher.interfaces.http import MethodNotAllowed, IMethodNotAllowed
from zope.publisher.interfaces import TraversalException
from zope.publisher.interfaces import TraversalException, NotFound
from zope.security.interfaces import Unauthorized
import zope.errorview

Expand Down Expand Up @@ -119,6 +119,13 @@ def test_traversalexceptionview(self):
self.assertEqual(self.request.response.getStatus(), 404)
# XXX test the MKCOL verb here too.

def test_notfound(self):
view = getMultiAdapter(
(NotFound(object(), self.request), self.request), name='index.html')
self.failUnless(IHTTPException.providedBy(view))
self.assertEquals(view(), '')
self.assertEqual(self.request.response.getStatus(), 404)

def test_unauthorizedexceptionview(self):
view = getMultiAdapter(
(Unauthorized(), self.request), name='index.html')
Expand Down

0 comments on commit 690f5d7

Please sign in to comment.