summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pyramid/tests/test_config/test_init.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/pyramid/tests/test_config/test_init.py b/pyramid/tests/test_config/test_init.py
index 1e58e4d0f..c9eaf7c27 100644
--- a/pyramid/tests/test_config/test_init.py
+++ b/pyramid/tests/test_config/test_init.py
@@ -546,6 +546,36 @@ class ConfiguratorTests(unittest.TestCase):
utility = reg.getUtility(IRequestFactory)
self.assertEqual(utility, factory)
+ def test_setup_registry_request_factory_custom_response_class(self):
+ from pyramid.registry import Registry
+ from pyramid.interfaces import IRequestFactory
+ from pyramid.request import Request
+
+ class MyResponse(object):
+ pass
+
+ class MyRequest(Request):
+ ResponseClass = MyResponse
+
+ reg = Registry()
+ config = self._makeOne(reg)
+ factory = MyRequest({
+ 'PATH_INFO': '/',
+ 'wsgi.url_scheme': 'http',
+ 'HTTP_HOST': 'localhost',
+ 'SERVER_PROTOCOL': '1.0',
+ })
+ factory.registry = reg
+
+ config.setup_registry(request_factory=factory)
+ self.assertEqual(reg.queryUtility(IRequestFactory), None)
+ config.commit()
+ utility = reg.getUtility(IRequestFactory)
+ self.assertEqual(utility, factory)
+
+ new_response = factory.response
+ self.assertTrue(isinstance(new_response, MyResponse))
+
def test_setup_registry_request_factory_dottedname(self):
from pyramid.registry import Registry
from pyramid.interfaces import IRequestFactory