diff options
| author | Tim Graham <timograham@gmail.com> | 2016-12-31 11:46:40 -0500 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-01-17 20:52:03 -0500 |
| commit | eba093e8b02989af1857b1915907ca0897f565ff (patch) | |
| tree | 9168860253e3956ced80b9e639e8e1c36211057c /tests/auth_tests/test_basic.py | |
| parent | b70094f0408384993e149ffcfc86cc2d405308d1 (diff) | |
Refs #25847 -- Removed support for User.is_(anonymous|authenticated) as methods.
Per deprecation timeline.
Diffstat (limited to 'tests/auth_tests/test_basic.py')
| -rw-r--r-- | tests/auth_tests/test_basic.py | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/tests/auth_tests/test_basic.py b/tests/auth_tests/test_basic.py index 2e18260e4c..4555e28270 100644 --- a/tests/auth_tests/test_basic.py +++ b/tests/auth_tests/test_basic.py @@ -1,8 +1,6 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -import warnings - from django.contrib.auth import get_user, get_user_model from django.contrib.auth.models import AnonymousUser, User from django.core.exceptions import ImproperlyConfigured @@ -56,26 +54,6 @@ class BasicTestCase(TestCase): with self.assertRaises(IntegrityError): User.objects.create_user(omega_username) - def test_is_anonymous_authenticated_method_deprecation(self): - deprecation_message = ( - 'Using user.is_authenticated() and user.is_anonymous() as a ' - 'method is deprecated. Remove the parentheses to use it as an ' - 'attribute.' - ) - u = User.objects.create_user('testuser', 'test@example.com', 'testpw') - # Backwards-compatibility callables - with warnings.catch_warnings(record=True) as warns: - warnings.simplefilter('always') - self.assertFalse(u.is_anonymous()) - self.assertEqual(len(warns), 1) - self.assertEqual(str(warns[0].message), deprecation_message) - - with warnings.catch_warnings(record=True) as warns: - warnings.simplefilter('always') - self.assertTrue(u.is_authenticated()) - self.assertEqual(len(warns), 1) - self.assertEqual(str(warns[0].message), deprecation_message) - def test_user_no_email(self): "Users can be created without an email" u = User.objects.create_user('testuser1') @@ -101,26 +79,6 @@ class BasicTestCase(TestCase): self.assertEqual(a.groups.all().count(), 0) self.assertEqual(a.user_permissions.all().count(), 0) - def test_anonymous_user_is_anonymous_authenticated_method_deprecation(self): - a = AnonymousUser() - deprecation_message = ( - 'Using user.is_authenticated() and user.is_anonymous() as a ' - 'method is deprecated. Remove the parentheses to use it as an ' - 'attribute.' - ) - # Backwards-compatibility callables - with warnings.catch_warnings(record=True) as warns: - warnings.simplefilter('always') # prevent warnings from appearing as errors - self.assertTrue(a.is_anonymous()) - self.assertEqual(len(warns), 1) - self.assertEqual(str(warns[0].message), deprecation_message) - - with warnings.catch_warnings(record=True) as warns: - warnings.simplefilter('always') # prevent warnings from appearing as errors - self.assertFalse(a.is_authenticated()) - self.assertEqual(len(warns), 1) - self.assertEqual(str(warns[0].message), deprecation_message) - def test_superuser(self): "Check the creation and properties of a superuser" super = User.objects.create_superuser('super', 'super@example.com', 'super') |
