summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Anderson <sontek@gmail.com>2014-12-26 04:17:42 -0800
committerJohn Anderson <sontek@gmail.com>2014-12-26 04:17:42 -0800
commitc0a01d1a49c9a02b1aa7266301fd64fb679e1d53 (patch)
treec944c94555feddec4dfed9be103d6ef6a38486d0
parent367ffec92bd502075e0f2f827f4b9d9b3caea748 (diff)
downloadpyramid-c0a01d1a49c9a02b1aa7266301fd64fb679e1d53.tar.gz
pyramid-c0a01d1a49c9a02b1aa7266301fd64fb679e1d53.tar.bz2
pyramid-c0a01d1a49c9a02b1aa7266301fd64fb679e1d53.zip
Added 2 more tests directly to the util function
-rw-r--r--pyramid/tests/test_util.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/pyramid/tests/test_util.py b/pyramid/tests/test_util.py
index a18fa8d16..c9c48aede 100644
--- a/pyramid/tests/test_util.py
+++ b/pyramid/tests/test_util.py
@@ -619,6 +619,33 @@ class TestActionInfo(unittest.TestCase):
"Line 0 of file filename:\n linerepr ")
+class TestGetResponseFactory(unittest.TestCase):
+ def test_no_request(self):
+ from pyramid.util import _get_response_factory
+ from pyramid.registry import Registry
+ from pyramid.response import Response
+
+ registry = Registry()
+ factory = _get_response_factory(registry)
+ self.assertEqual(factory, Response)
+
+ def test_with_request(self):
+ from pyramid.util import _get_response_factory
+ from pyramid.registry import Registry
+ from pyramid.request import Request
+
+ class MyResponse(object):
+ pass
+
+ class MyRequest(Request):
+ ResponseClass = MyResponse
+ registry = Registry()
+
+ request = MyRequest({})
+ factory = _get_response_factory(registry, request)
+ self.assertEqual(factory, MyResponse)
+
+
def dummyfunc(): pass
class Dummy(object):