diff options
| author | Tim Graham <timograham@gmail.com> | 2016-05-09 13:13:55 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-05-17 07:22:26 -0400 |
| commit | ece4d24f8e494129c098868fa792400937941fab (patch) | |
| tree | f5f2b3211ffae49375c5e7390f4ed25e07110b3b /tests | |
| parent | 9baf692a58de78dba13aa582098781675367c329 (diff) | |
Refs #26601 -- Deprecated old-style middleware.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/auth_tests/test_context_processors.py | 4 | ||||
| -rw-r--r-- | tests/auth_tests/test_remote_user.py | 3 | ||||
| -rw-r--r-- | tests/flatpages_tests/test_csrf.py | 3 | ||||
| -rw-r--r-- | tests/flatpages_tests/test_middleware.py | 4 | ||||
| -rw-r--r-- | tests/middleware_exceptions/tests.py | 6 | ||||
| -rw-r--r-- | tests/redirects_tests/tests.py | 4 | ||||
| -rw-r--r-- | tests/template_tests/test_response.py | 5 | ||||
| -rw-r--r-- | tests/view_tests/tests/test_csrf.py | 3 | ||||
| -rw-r--r-- | tests/view_tests/tests/test_i18n.py | 4 |
9 files changed, 32 insertions, 4 deletions
diff --git a/tests/auth_tests/test_context_processors.py b/tests/auth_tests/test_context_processors.py index d1db63c7b2..150703440b 100644 --- a/tests/auth_tests/test_context_processors.py +++ b/tests/auth_tests/test_context_processors.py @@ -4,6 +4,8 @@ from django.contrib.auth.models import Permission, User from django.contrib.contenttypes.models import ContentType from django.db.models import Q from django.test import SimpleTestCase, TestCase, override_settings +from django.test.utils import ignore_warnings +from django.utils.deprecation import RemovedInDjango20Warning from .settings import AUTH_MIDDLEWARE, AUTH_TEMPLATES @@ -76,6 +78,7 @@ class AuthContextProcessorTests(TestCase): response = self.client.get('/auth_processor_no_attr_access/') self.assertContains(response, "Session not accessed") + @ignore_warnings(category=RemovedInDjango20Warning) @override_settings(MIDDLEWARE_CLASSES=AUTH_MIDDLEWARE, MIDDLEWARE=None) def test_session_not_accessed_middleware_classes(self): response = self.client.get('/auth_processor_no_attr_access/') @@ -90,6 +93,7 @@ class AuthContextProcessorTests(TestCase): response = self.client.get('/auth_processor_attr_access/') self.assertContains(response, "Session accessed") + @ignore_warnings(category=RemovedInDjango20Warning) @override_settings(MIDDLEWARE_CLASSES=AUTH_MIDDLEWARE, MIDDLEWARE=None) def test_session_is_accessed_middleware_classes(self): response = self.client.get('/auth_processor_attr_access/') diff --git a/tests/auth_tests/test_remote_user.py b/tests/auth_tests/test_remote_user.py index 1cb7666a49..2b5bf32d74 100644 --- a/tests/auth_tests/test_remote_user.py +++ b/tests/auth_tests/test_remote_user.py @@ -6,7 +6,9 @@ from django.contrib.auth.backends import RemoteUserBackend from django.contrib.auth.middleware import RemoteUserMiddleware from django.contrib.auth.models import User from django.test import TestCase, modify_settings, override_settings +from django.test.utils import ignore_warnings from django.utils import timezone +from django.utils.deprecation import RemovedInDjango20Warning @override_settings(ROOT_URLCONF='auth_tests.urls') @@ -151,6 +153,7 @@ class RemoteUserTest(TestCase): self.assertTrue(response.context['user'].is_anonymous) +@ignore_warnings(category=RemovedInDjango20Warning) @override_settings(MIDDLEWARE=None) class RemoteUserTestMiddlewareClasses(RemoteUserTest): diff --git a/tests/flatpages_tests/test_csrf.py b/tests/flatpages_tests/test_csrf.py index b4ae186d0c..c71d9dfca6 100644 --- a/tests/flatpages_tests/test_csrf.py +++ b/tests/flatpages_tests/test_csrf.py @@ -2,6 +2,8 @@ from django.contrib.auth.models import User from django.contrib.flatpages.models import FlatPage from django.contrib.sites.models import Site from django.test import Client, TestCase, modify_settings, override_settings +from django.test.utils import ignore_warnings +from django.utils.deprecation import RemovedInDjango20Warning from .settings import FLATPAGES_TEMPLATES @@ -99,6 +101,7 @@ class FlatpageCSRFTests(TestCase): self.assertEqual(response.status_code, 404) +@ignore_warnings(category=RemovedInDjango20Warning) @override_settings( MIDDLEWARE=None, MIDDLEWARE_CLASSES=[ diff --git a/tests/flatpages_tests/test_middleware.py b/tests/flatpages_tests/test_middleware.py index 8d04076af6..bba7d6becf 100644 --- a/tests/flatpages_tests/test_middleware.py +++ b/tests/flatpages_tests/test_middleware.py @@ -3,6 +3,8 @@ from django.contrib.auth.models import User from django.contrib.flatpages.models import FlatPage from django.contrib.sites.models import Site from django.test import TestCase, modify_settings, override_settings +from django.test.utils import ignore_warnings +from django.utils.deprecation import RemovedInDjango20Warning from .settings import FLATPAGES_TEMPLATES @@ -107,6 +109,7 @@ class FlatpageMiddlewareTests(TestDataMixin, TestCase): self.assertContains(response, "<p>Isn't it special!</p>") +@ignore_warnings(category=RemovedInDjango20Warning) @override_settings( MIDDLEWARE=None, MIDDLEWARE_CLASSES=[ @@ -189,6 +192,7 @@ class FlatpageMiddlewareAppendSlashTests(TestDataMixin, TestCase): self.assertContains(response, "<p>Root</p>") +@ignore_warnings(category=RemovedInDjango20Warning) @override_settings( MIDDLEWARE=None, MIDDLEWARE_CLASSES=[ diff --git a/tests/middleware_exceptions/tests.py b/tests/middleware_exceptions/tests.py index 13b33632f8..58ac5b965f 100644 --- a/tests/middleware_exceptions/tests.py +++ b/tests/middleware_exceptions/tests.py @@ -7,8 +7,8 @@ from django.http import HttpResponse from django.template import engines from django.template.response import TemplateResponse from django.test import RequestFactory, SimpleTestCase, override_settings -from django.test.utils import patch_logger -from django.utils.deprecation import MiddlewareMixin +from django.test.utils import ignore_warnings, patch_logger +from django.utils.deprecation import MiddlewareMixin, RemovedInDjango20Warning class TestException(Exception): @@ -117,6 +117,7 @@ class NoResponseMiddleware(TestMiddleware): super(NoResponseMiddleware, self).process_response(request, response) +@ignore_warnings(category=RemovedInDjango20Warning) @override_settings( ROOT_URLCONF='middleware_exceptions.urls', MIDDLEWARE_CLASSES=['django.middleware.common.CommonMiddleware'], @@ -929,6 +930,7 @@ class MiddlewareNotUsedTests(SimpleTestCase): self.assertEqual(len(calls), 0) +@ignore_warnings(category=RemovedInDjango20Warning) @override_settings( MIDDLEWARE_CLASSES=['django.middleware.common.CommonMiddleware'], MIDDLEWARE=None, diff --git a/tests/redirects_tests/tests.py b/tests/redirects_tests/tests.py index b4210ad49b..d566b69006 100644 --- a/tests/redirects_tests/tests.py +++ b/tests/redirects_tests/tests.py @@ -5,7 +5,9 @@ from django.contrib.redirects.models import Redirect from django.contrib.sites.models import Site from django.core.exceptions import ImproperlyConfigured from django.test import TestCase, modify_settings, override_settings +from django.test.utils import ignore_warnings from django.utils import six +from django.utils.deprecation import RemovedInDjango20Warning @modify_settings(MIDDLEWARE={'append': 'django.contrib.redirects.middleware.RedirectFallbackMiddleware'}) @@ -42,11 +44,13 @@ class RedirectTests(TestCase): response = self.client.get('/initial') self.assertEqual(response.status_code, 410) + @ignore_warnings(category=RemovedInDjango20Warning) @override_settings(MIDDLEWARE=None) @modify_settings(MIDDLEWARE_CLASSES={'append': 'django.contrib.redirects.middleware.RedirectFallbackMiddleware'}) def test_redirect_middleware_classes(self): self.test_redirect() + @ignore_warnings(category=RemovedInDjango20Warning) @override_settings(MIDDLEWARE=None) @modify_settings(MIDDLEWARE_CLASSES={'append': 'django.contrib.redirects.middleware.RedirectFallbackMiddleware'}) def test_more_redirects_middleware_classes(self): diff --git a/tests/template_tests/test_response.py b/tests/template_tests/test_response.py index c2ece4b2a8..19e8e1fe99 100644 --- a/tests/template_tests/test_response.py +++ b/tests/template_tests/test_response.py @@ -11,8 +11,8 @@ from django.template.response import ( from django.test import ( RequestFactory, SimpleTestCase, modify_settings, override_settings, ) -from django.test.utils import require_jinja2 -from django.utils.deprecation import MiddlewareMixin +from django.test.utils import ignore_warnings, require_jinja2 +from django.utils.deprecation import MiddlewareMixin, RemovedInDjango20Warning from .utils import TEMPLATE_DIR @@ -361,6 +361,7 @@ class CacheMiddlewareTest(SimpleTestCase): self.assertNotEqual(response.content, response2.content) +@ignore_warnings(category=RemovedInDjango20Warning) @override_settings( MIDDLEWARE=None, MIDDLEWARE_CLASSES=[ diff --git a/tests/view_tests/tests/test_csrf.py b/tests/view_tests/tests/test_csrf.py index 22bf96529f..fdd9715476 100644 --- a/tests/view_tests/tests/test_csrf.py +++ b/tests/view_tests/tests/test_csrf.py @@ -2,6 +2,8 @@ from django.template import TemplateDoesNotExist from django.test import ( Client, RequestFactory, SimpleTestCase, override_settings, ) +from django.test.utils import ignore_warnings +from django.utils.deprecation import RemovedInDjango20Warning from django.utils.translation import override from django.views.csrf import CSRF_FAILURE_TEMPLATE_NAME, csrf_failure @@ -38,6 +40,7 @@ class CsrfViewTests(SimpleTestCase): "CSRF-verificatie mislukt. Verzoek afgebroken.", status_code=403) + @ignore_warnings(category=RemovedInDjango20Warning) @override_settings( USE_I18N=True, MIDDLEWARE=None, diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py index a50b7d6460..e1cf44782d 100644 --- a/tests/view_tests/tests/test_i18n.py +++ b/tests/view_tests/tests/test_i18n.py @@ -10,9 +10,11 @@ from django.test import ( SimpleTestCase, TestCase, modify_settings, override_settings, ) from django.test.selenium import SeleniumTestCase +from django.test.utils import ignore_warnings from django.urls import reverse from django.utils import six from django.utils._os import upath +from django.utils.deprecation import RemovedInDjango20Warning from django.utils.translation import ( LANGUAGE_SESSION_KEY, get_language, override, ) @@ -138,6 +140,7 @@ class I18NTests(TestCase): self.assertEqual(language_cookie['path'], '/test/') self.assertEqual(language_cookie['max-age'], 3600 * 7 * 2) + @ignore_warnings(category=RemovedInDjango20Warning) def test_setlang_cookie_middleware_classes(self): # we force saving language to a cookie rather than a session # by excluding session middleware and those which do require it @@ -187,6 +190,7 @@ class I18NTests(TestCase): ) self.assertRedirects(response, '/en/translated/') + @ignore_warnings(category=RemovedInDjango20Warning) @override_settings( MIDDLEWARE=None, MIDDLEWARE_CLASSES=[ |
