Ticket #17848: 17848.diff

File 17848.diff, 1.6 KB (added by ryankask, 3 years ago)
  • django/contrib/auth/tests/context_processors.py

    diff --git a/django/contrib/auth/tests/context_processors.py b/django/contrib/auth/tests/context_processors.py
    index 8f77940..59301b6 100644
    a b class AuthContextProcessorTests(TestCase): 
    2424        Tests that the session is not accessed simply by including
    2525        the auth context processor
    2626        """
     27        _saved_standard_context_processors = context._standard_context_processors
    2728        context._standard_context_processors = None
    2829
    2930        response = self.client.get('/auth_processor_no_attr_access/')
    3031        self.assertContains(response, "Session not accessed")
    3132
     33        context._standard_context_processors = _saved_standard_context_processors
     34
    3235    @override_settings(
    3336        MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES,
    3437        TEMPLATE_CONTEXT_PROCESSORS=global_settings.TEMPLATE_CONTEXT_PROCESSORS,
    class AuthContextProcessorTests(TestCase): 
    3841        Tests that the session is accessed if the auth context processor
    3942        is used and relevant attributes accessed.
    4043        """
     44        _saved_standard_context_processors = context._standard_context_processors
    4145        context._standard_context_processors = None
    4246
    4347        response = self.client.get('/auth_processor_attr_access/')
    4448        self.assertContains(response, "Session accessed")
    4549
     50        context._standard_context_processors = _saved_standard_context_processors
     51
    4652    def test_perms_attrs(self):
    4753        self.client.login(username='super', password='secret')
    4854        response = self.client.get('/auth_processor_perms/')
Back to Top