summaryrefslogtreecommitdiff
path: root/repoze/bfg/tests
diff options
context:
space:
mode:
authorChris McDonough <chrism@agendaless.com>2010-09-06 00:06:48 +0000
committerChris McDonough <chrism@agendaless.com>2010-09-06 00:06:48 +0000
commiteb7ea411bfce55085449b79ac88aac19af0e232f (patch)
tree6c98b973c746d4c37a5d7f40078aefd9dd1c4d23 /repoze/bfg/tests
parent8deae21c801bc05c6464a6eead3df449ed1fe52d (diff)
downloadpyramid-eb7ea411bfce55085449b79ac88aac19af0e232f.tar.gz
pyramid-eb7ea411bfce55085449b79ac88aac19af0e232f.tar.bz2
pyramid-eb7ea411bfce55085449b79ac88aac19af0e232f.zip
- The ``repoze.bfg.interfaces.INewResponse`` interface now includes a
``request`` attribute; as a result, a handler for INewResponse now has access to the request which caused the response. - The INewResponse event is now not sent to listeners if the response returned by view code (or a renderer) is not a "real" response (e.g. if it does not have ``.status``, ``.headerlist`` and ``.app_iter`` attribtues).
Diffstat (limited to 'repoze/bfg/tests')
-rw-r--r--repoze/bfg/tests/test_events.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/repoze/bfg/tests/test_events.py b/repoze/bfg/tests/test_events.py
index c258c4ad2..c122f4744 100644
--- a/repoze/bfg/tests/test_events.py
+++ b/repoze/bfg/tests/test_events.py
@@ -31,8 +31,8 @@ class NewResponseEventTests(unittest.TestCase):
from repoze.bfg.events import NewResponse
return NewResponse
- def _makeOne(self, response):
- return self._getTargetClass()(response)
+ def _makeOne(self, request, response):
+ return self._getTargetClass()(request, response)
def test_class_implements(self):
from repoze.bfg.interfaces import INewResponse
@@ -43,13 +43,16 @@ class NewResponseEventTests(unittest.TestCase):
def test_instance_implements(self):
from repoze.bfg.interfaces import INewResponse
from zope.interface.verify import verifyObject
+ request = DummyRequest()
response = DummyResponse()
- inst = self._makeOne(response)
+ inst = self._makeOne(request, response)
verifyObject(INewResponse, inst)
def test_ctor(self):
+ request = DummyRequest()
response = DummyResponse()
- inst = self._makeOne(response)
+ inst = self._makeOne(request, response)
+ self.assertEqual(inst.request, request)
self.assertEqual(inst.response, response)
class WSGIAppEventTests(unittest.TestCase):