'CACHE_MIDDLEWARE_ANONYMOUS_ONLY should still be effective when used
with the cache_page decorator: the response to a request from an
authenticated user should not be cached.'

@override_settings(CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True)
def test_cache_middleware_anonymous_only_with_cache_page(self):

    request = self.factory.get(u'/view_anon/')
    class MockAuthenticatedUser(object, ):
        def is_authenticated(self):
            return True
    class MockAccessedSession(object, ):
        accessed = True
    request.user = MockAuthenticatedUser()
    request.session = MockAccessedSession()
    response = cache_page(60)(hello_world_view)(request, u'1')
    self.assertFalse((u'Cache-Control' in response))
