diff options
author | Bouke Haarsma <bouke@webatoom.nl> | 2013-10-15 22:36:49 +0200 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2013-10-17 09:42:28 -0400 |
commit | 2fb5a51fa3ac276efc7121ec9de91f092a986104 (patch) | |
tree | 77f8d7072b079cb9cddb1e8e05bb613681705f7b /tests/deprecation | |
parent | 98788d3c3af9f6cce2b94c276d17726f46608b08 (diff) | |
download | django-2fb5a51fa3ac276efc7121ec9de91f092a986104.tar.gz |
Fixed #18659 -- Deprecated request.REQUEST and MergeDict
Thanks Aymeric Augustin for the suggestion.
Diffstat (limited to 'tests/deprecation')
-rw-r--r-- | tests/deprecation/tests.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/deprecation/tests.py b/tests/deprecation/tests.py index 719bd635db..5353a16e42 100644 --- a/tests/deprecation/tests.py +++ b/tests/deprecation/tests.py @@ -1,8 +1,9 @@ from __future__ import unicode_literals import warnings -from django.test import SimpleTestCase +from django.test import SimpleTestCase, RequestFactory from django.utils import six +from django.utils.datastructures import MergeDict from django.utils.deprecation import RenameMethodsBase @@ -156,3 +157,22 @@ class RenameMethodsTests(SimpleTestCase): '`DeprecatedMixin.old` is deprecated, use `new` instead.', '`RenamedMixin.old` is deprecated, use `new` instead.', ]) + + +class DeprecatingRequestMergeDictTest(SimpleTestCase): + def test_deprecated_request(self): + """ + Ensure the correct warning is raised when WSGIRequest.REQUEST is + accessed. + """ + with warnings.catch_warnings(record=True) as recorded: + warnings.simplefilter('always') + request = RequestFactory().get('/') + _ = request.REQUEST + + msgs = [str(warning.message) for warning in recorded] + self.assertEqual(msgs, [ + '`request.REQUEST` is deprecated, use `request.GET` or ' + '`request.POST` instead.', + '`MergeDict` is deprecated, use `dict.update()` instead.', + ]) |