diff options
| author | Simon Charette <charettes@users.noreply.github.com> | 2017-01-19 02:39:46 -0500 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2017-01-19 08:39:46 +0100 |
| commit | cecc079168e8669138728d31611ff3a1e7eb3a9f (patch) | |
| tree | 2415083d44f84c6f206930fc689a8c0e50a98caa /tests/auth_tests | |
| parent | a5563963397aeee30c32e3c1dab31bfe453ca89f (diff) | |
Refs #23919 -- Stopped inheriting from object to define new style classes.
Diffstat (limited to 'tests/auth_tests')
| -rw-r--r-- | tests/auth_tests/models/custom_user.py | 2 | ||||
| -rw-r--r-- | tests/auth_tests/test_admin_multidb.py | 2 | ||||
| -rw-r--r-- | tests/auth_tests/test_auth_backends.py | 10 | ||||
| -rw-r--r-- | tests/auth_tests/test_auth_backends_deprecation.py | 2 | ||||
| -rw-r--r-- | tests/auth_tests/test_context_processors.py | 4 | ||||
| -rw-r--r-- | tests/auth_tests/test_decorators.py | 2 | ||||
| -rw-r--r-- | tests/auth_tests/test_forms.py | 2 | ||||
| -rw-r--r-- | tests/auth_tests/test_management.py | 4 |
8 files changed, 14 insertions, 14 deletions
diff --git a/tests/auth_tests/models/custom_user.py b/tests/auth_tests/models/custom_user.py index 049ae85e5c..60fcc494c4 100644 --- a/tests/auth_tests/models/custom_user.py +++ b/tests/auth_tests/models/custom_user.py @@ -74,7 +74,7 @@ class CustomUser(AbstractBaseUser): return self.is_admin -class RemoveGroupsAndPermissions(object): +class RemoveGroupsAndPermissions: """ A context manager to temporarily remove the groups and user_permissions M2M fields from the AbstractUser class, so they don't clash with the diff --git a/tests/auth_tests/test_admin_multidb.py b/tests/auth_tests/test_admin_multidb.py index 9d0d999739..122cb78876 100644 --- a/tests/auth_tests/test_admin_multidb.py +++ b/tests/auth_tests/test_admin_multidb.py @@ -7,7 +7,7 @@ from django.test import TestCase, mock, override_settings from django.urls import reverse -class Router(object): +class Router: target_db = None def db_for_read(self, model, **hints): diff --git a/tests/auth_tests/test_auth_backends.py b/tests/auth_tests/test_auth_backends.py index f06e825698..033df9c682 100644 --- a/tests/auth_tests/test_auth_backends.py +++ b/tests/auth_tests/test_auth_backends.py @@ -29,7 +29,7 @@ class CountingMD5PasswordHasher(MD5PasswordHasher): return super(CountingMD5PasswordHasher, self).encode(*args, **kwargs) -class BaseModelBackendTest(object): +class BaseModelBackendTest: """ A base class for tests that need to validate the ModelBackend with different User models. Subclasses should define a class @@ -319,11 +319,11 @@ class UUIDUserTests(TestCase): self.assertEqual(UUIDUser.objects.get(pk=self.client.session[SESSION_KEY]), user) -class TestObj(object): +class TestObj: pass -class SimpleRowlevelBackend(object): +class SimpleRowlevelBackend: def has_perm(self, user, perm, obj=None): if not obj: return # We only support row level perms @@ -468,7 +468,7 @@ class InActiveUserBackendTest(TestCase): self.assertIs(self.user1.has_module_perms("app2"), False) -class PermissionDeniedBackend(object): +class PermissionDeniedBackend: """ Always raises PermissionDenied in `authenticate`, `has_perm` and `has_module_perms`. """ @@ -573,7 +573,7 @@ class ChangedBackendSettingsTest(TestCase): self.assertTrue(user.is_anonymous) -class TypeErrorBackend(object): +class TypeErrorBackend: """ Always raises TypeError. """ diff --git a/tests/auth_tests/test_auth_backends_deprecation.py b/tests/auth_tests/test_auth_backends_deprecation.py index 6178936535..fc39d0be22 100644 --- a/tests/auth_tests/test_auth_backends_deprecation.py +++ b/tests/auth_tests/test_auth_backends_deprecation.py @@ -4,7 +4,7 @@ from django.contrib.auth import authenticate from django.test import SimpleTestCase, override_settings -class NoRequestBackend(object): +class NoRequestBackend: def authenticate(self, username=None, password=None): # Doesn't accept a request parameter. pass diff --git a/tests/auth_tests/test_context_processors.py b/tests/auth_tests/test_context_processors.py index 3857917860..d66b28cb9c 100644 --- a/tests/auth_tests/test_context_processors.py +++ b/tests/auth_tests/test_context_processors.py @@ -8,7 +8,7 @@ from django.test import SimpleTestCase, TestCase, override_settings from .settings import AUTH_MIDDLEWARE, AUTH_TEMPLATES -class MockUser(object): +class MockUser: def has_module_perms(self, perm): if perm == 'mockapp': return True @@ -24,7 +24,7 @@ class PermWrapperTests(SimpleTestCase): """ Test some details of the PermWrapper implementation. """ - class EQLimiterObject(object): + class EQLimiterObject: """ This object makes sure __eq__ will not be called endlessly. """ diff --git a/tests/auth_tests/test_decorators.py b/tests/auth_tests/test_decorators.py index dc3482de22..55c422bdc6 100644 --- a/tests/auth_tests/test_decorators.py +++ b/tests/auth_tests/test_decorators.py @@ -19,7 +19,7 @@ class LoginRequiredTestCase(AuthViewsTestCase): """ login_required is assignable to callable objects. """ - class CallableView(object): + class CallableView: def __call__(self, *args, **kwargs): pass login_required(CallableView()) diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py index c055b58042..ae6fa313de 100644 --- a/tests/auth_tests/test_forms.py +++ b/tests/auth_tests/test_forms.py @@ -27,7 +27,7 @@ from .models.with_integer_username import IntegerUsernameUser from .settings import AUTH_TEMPLATES -class TestDataMixin(object): +class TestDataMixin: @classmethod def setUpTestData(cls): diff --git a/tests/auth_tests/test_management.py b/tests/auth_tests/test_management.py index 4fd1563f84..12d029ffcd 100644 --- a/tests/auth_tests/test_management.py +++ b/tests/auth_tests/test_management.py @@ -62,7 +62,7 @@ def mock_inputs(inputs): return inner -class MockTTY(object): +class MockTTY: """ A fake stdin object that pretends to be a TTY to be used in conjunction with mock_inputs. @@ -329,7 +329,7 @@ class CreatesuperuserManagementCommandTestCase(TestCase): If the command is not called from a TTY, it should be skipped and a message should be displayed (#7423). """ - class FakeStdin(object): + class FakeStdin: """A fake stdin object that has isatty() return False.""" def isatty(self): return False |
