Commit 5f7230e1 authored by Aymeric Augustin's avatar Aymeric Augustin
Browse files

Fixed #24124 (again) -- Updated tests with new default context_processors.

Thanks Collin for the review.
parent 511a53b3
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -15,11 +15,6 @@ AUTH_TEMPLATES = [{
    'OPTIONS': {
        'context_processors': (
            'django.contrib.auth.context_processors.auth',
            'django.template.context_processors.debug',
            'django.template.context_processors.i18n',
            'django.template.context_processors.media',
            'django.template.context_processors.static',
            'django.template.context_processors.tz',
            'django.contrib.messages.context_processors.messages',
        ),
    },
+2 −7
Original line number Diff line number Diff line
@@ -800,10 +800,7 @@ class AdminViewBasicTest(AdminViewBasicTestCase):
    'OPTIONS': {
        'context_processors': [
            'django.template.context_processors.debug',
            'django.template.context_processors.i18n',
            'django.template.context_processors.tz',
            'django.template.context_processors.media',
            'django.template.context_processors.static',
            'django.template.context_processors.request',
            'django.contrib.auth.context_processors.auth',
            'django.contrib.messages.context_processors.messages',
        ],
@@ -4499,9 +4496,7 @@ class AdminDocsTest(TestCase):
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.tz',
                'django.template.context_processors.media',
                'django.template.context_processors.static',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
+2 −5
Original line number Diff line number Diff line
@@ -123,12 +123,9 @@ def setup(verbosity, test_labels):
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.contrib.auth.context_processors.auth',
                'django.template.context_processors.debug',
                'django.template.context_processors.i18n',
                'django.template.context_processors.media',
                'django.template.context_processors.static',
                'django.template.context_processors.tz',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
+1 −1
Original line number Diff line number Diff line
{{ foo }}.{{ bar }}.{{ baz }}.{{ STATIC_URL }}
{{ foo }}.{{ bar }}.{{ baz }}.{{ request.path }}
+5 −6
Original line number Diff line number Diff line
@@ -3,7 +3,6 @@ from django.test import TestCase, ignore_warnings, override_settings


@override_settings(
    STATIC_URL='/path/to/static/media/',
    ROOT_URLCONF='shortcuts.urls',
)
class ShortcutTests(TestCase):
@@ -23,7 +22,7 @@ class ShortcutTests(TestCase):
    def test_render_to_response_with_request_context(self):
        response = self.client.get('/render_to_response/request_context/')
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, b'FOO.BAR../path/to/static/media/\n')
        self.assertEqual(response.content, b'FOO.BAR../render_to_response/request_context/\n')
        self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')

    def test_render_to_response_with_content_type(self):
@@ -52,14 +51,14 @@ class ShortcutTests(TestCase):
    def test_render(self):
        response = self.client.get('/render/')
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, b'FOO.BAR../path/to/static/media/\n')
        self.assertEqual(response.content, b'FOO.BAR../render/\n')
        self.assertEqual(response['Content-Type'], 'text/html; charset=utf-8')
        self.assertFalse(hasattr(response.context.request, 'current_app'))

    def test_render_with_multiple_templates(self):
        response = self.client.get('/render/multiple_templates/')
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, b'FOO.BAR../path/to/static/media/\n')
        self.assertEqual(response.content, b'FOO.BAR../render/multiple_templates/\n')

    @ignore_warnings(category=RemovedInDjango20Warning)
    def test_render_with_base_context(self):
@@ -71,13 +70,13 @@ class ShortcutTests(TestCase):
    def test_render_with_content_type(self):
        response = self.client.get('/render/content_type/')
        self.assertEqual(response.status_code, 200)
        self.assertEqual(response.content, b'FOO.BAR../path/to/static/media/\n')
        self.assertEqual(response.content, b'FOO.BAR../render/content_type/\n')
        self.assertEqual(response['Content-Type'], 'application/x-rendertest')

    def test_render_with_status(self):
        response = self.client.get('/render/status/')
        self.assertEqual(response.status_code, 403)
        self.assertEqual(response.content, b'FOO.BAR../path/to/static/media/\n')
        self.assertEqual(response.content, b'FOO.BAR../render/status/\n')

    @ignore_warnings(category=RemovedInDjango20Warning)
    def test_render_with_current_app(self):
Loading