From 4a438e400b7ce0ab9d0b6876196cbe8d620a4171 Mon Sep 17 00:00:00 2001 From: Markus Bertheau Date: Mon, 27 Apr 2015 23:56:02 +0200 Subject: Fixed #13008 -- Added more Cache-Control headers to never_cache() decorator. --- tests/decorators/tests.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests') diff --git a/tests/decorators/tests.py b/tests/decorators/tests.py index d3e2eddf8c..d6b2c78068 100644 --- a/tests/decorators/tests.py +++ b/tests/decorators/tests.py @@ -317,3 +317,15 @@ class XFrameOptionsDecoratorsTests(TestCase): # the middleware's functionality, let's make sure it actually works... r = XFrameOptionsMiddleware().process_response(req, resp) self.assertEqual(r.get('X-Frame-Options', None), None) + + +class NeverCacheDecoratorTest(TestCase): + def test_never_cache_decorator(self): + @never_cache + def a_view(request): + return HttpResponse() + r = a_view(HttpRequest()) + self.assertEqual( + set(r['Cache-Control'].split(', ')), + {'max-age=0', 'no-cache', 'no-store', 'must-revalidate'}, + ) -- cgit v1.3