From 839ea015f9bc8c8096107e700a42bb872e9dc0c8 Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 23 Oct 2009 20:02:14 +0000 Subject: - Added ``max_age`` parameter to ``authtktauthenticationpolicy`` ZCML directive. If this value is set, it must be an integer representing the number of seconds which the auth tkt cookie will survive. Mainly, its existence allows the auth_tkt cookie to survive across browser sessions. - The ``reissue_time`` argument to the ``authtktauthenticationpolicy`` ZCML directive now actually works. When it is set to an integer value, an authticket set-cookie header is appended to the response whenever a request requires authentication and 'now' minus the authticket's timestamp is greater than ``reissue_time`` seconds. - The router now checks for a ``global_response_headers`` attribute of the request object before returning a response. If this value exists, it is presumed to be a sequence of two-tuples, representing a set of headers to append to the 'normal' response headers. This feature is internal, rather than exposed internally, because it's unclear whether it will stay around in the long term. It was added to support the ``reissue_time`` feature of the authtkt authentication policy. - The ``authtkt`` authentication policy ``remember`` method now no longer honors ``token`` or ``userdata`` keyword arguments. --- repoze/bfg/tests/test_request.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'repoze/bfg/tests/test_request.py') diff --git a/repoze/bfg/tests/test_request.py b/repoze/bfg/tests/test_request.py index 8aeeff42d..78564e57e 100644 --- a/repoze/bfg/tests/test_request.py +++ b/repoze/bfg/tests/test_request.py @@ -99,6 +99,26 @@ class Test_create_route_request_factory(unittest.TestCase): self.failUnless(IRouteRequest.implementedBy(factory)) self.failUnless(IRequest.implementedBy(factory)) +class Test_add_global_response_headers(unittest.TestCase): + def _callFUT(self, request, headerlist): + from repoze.bfg.request import add_global_response_headers + return add_global_response_headers(request, headerlist) + + def test_no_adhoc_attrs(self): + request = DummyRequest() + headers = [('a', 1), ('b', 2)] + self._callFUT(request, headers) + attrs = request.environ['webob.adhoc_attrs'] + self.assertEqual(attrs['global_response_headers'], headers) + + def test_with_adhoc_attrs(self): + request = DummyRequest() + headers = [('a', 1), ('b', 2)] + attrs = request.environ['webob.adhoc_attrs'] = {} + attrs['global_response_headers'] = headers[:] + self._callFUT(request, [('c', 1)]) + self.assertEqual(attrs['global_response_headers'], headers + [('c', 1)]) + class DummyRoute: def __init__(self, name): self.name = name -- cgit v1.2.3