From c0a01d1a49c9a02b1aa7266301fd64fb679e1d53 Mon Sep 17 00:00:00 2001 From: John Anderson Date: Fri, 26 Dec 2014 04:17:42 -0800 Subject: Added 2 more tests directly to the util function --- pyramid/tests/test_util.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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): -- cgit v1.2.3