summaryrefslogtreecommitdiff
path: root/tests/auth_tests
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2024-01-26 12:45:07 +0100
committerGitHub <noreply@github.com>2024-01-26 12:45:07 +0100
commit305757aec19c9d5111e4d76095ae0acd66163e4b (patch)
tree04aa017e66c06b3b19cb466ed4e1d73cd871523d /tests/auth_tests
parent3f6d939c62efd967f548c27a265748cc2cc47ca5 (diff)
Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
Diffstat (limited to 'tests/auth_tests')
-rw-r--r--tests/auth_tests/models/custom_permissions.py1
-rw-r--r--tests/auth_tests/test_forms.py11
-rw-r--r--tests/auth_tests/test_hashers.py15
-rw-r--r--tests/auth_tests/test_views.py6
4 files changed, 19 insertions, 14 deletions
diff --git a/tests/auth_tests/models/custom_permissions.py b/tests/auth_tests/models/custom_permissions.py
index 52d28bd276..385de4e846 100644
--- a/tests/auth_tests/models/custom_permissions.py
+++ b/tests/auth_tests/models/custom_permissions.py
@@ -3,6 +3,7 @@ The CustomPermissionsUser users email as the identifier, but uses the normal
Django permissions model. This allows us to check that the PermissionsMixin
includes everything that is needed to interact with the ModelBackend.
"""
+
from django.contrib.auth.models import AbstractBaseUser, PermissionsMixin
from django.db import models
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
index 14d71572da..14604cd2e6 100644
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -486,8 +486,9 @@ class AuthenticationFormTest(TestDataMixin, TestCase):
user_login_failed.disconnect(signal_handler)
def test_inactive_user_i18n(self):
- with self.settings(USE_I18N=True), translation.override(
- "pt-br", deactivate=True
+ with (
+ self.settings(USE_I18N=True),
+ translation.override("pt-br", deactivate=True),
):
# The user is inactive.
data = {
@@ -906,9 +907,9 @@ class UserChangeFormTest(TestDataMixin, TestCase):
class MyUserForm(UserChangeForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
- self.fields[
- "groups"
- ].help_text = "These groups give users different permissions"
+ self.fields["groups"].help_text = (
+ "These groups give users different permissions"
+ )
class Meta(UserChangeForm.Meta):
fields = ("groups",)
diff --git a/tests/auth_tests/test_hashers.py b/tests/auth_tests/test_hashers.py
index e0b640a998..1b0d2c65be 100644
--- a/tests/auth_tests/test_hashers.py
+++ b/tests/auth_tests/test_hashers.py
@@ -213,8 +213,9 @@ class TestUtilsHashPass(SimpleTestCase):
with mock.patch.object(hasher, "rounds", 4):
encoded = make_password("letmein", hasher="bcrypt")
- with mock.patch.object(hasher, "rounds", 6), mock.patch.object(
- hasher, "encode", side_effect=hasher.encode
+ with (
+ mock.patch.object(hasher, "rounds", 6),
+ mock.patch.object(hasher, "encode", side_effect=hasher.encode),
):
hasher.harden_runtime("wrong_password", encoded)
@@ -388,8 +389,9 @@ class TestUtilsHashPass(SimpleTestCase):
with mock.patch.object(hasher, "iterations", 1):
encoded = make_password("letmein")
- with mock.patch.object(hasher, "iterations", 6), mock.patch.object(
- hasher, "encode", side_effect=hasher.encode
+ with (
+ mock.patch.object(hasher, "iterations", 6),
+ mock.patch.object(hasher, "encode", side_effect=hasher.encode),
):
hasher.harden_runtime("wrong_password", encoded)
@@ -437,8 +439,9 @@ class TestUtilsHashPass(SimpleTestCase):
hasher = get_hasher("default")
encoded = make_password("letmein")
- with mock.patch.object(hasher, "harden_runtime"), mock.patch.object(
- hasher, "must_update", return_value=True
+ with (
+ mock.patch.object(hasher, "harden_runtime"),
+ mock.patch.object(hasher, "must_update", return_value=True),
):
# Correct password supplied, no hardening needed
check_password("letmein", encoded)
diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py
index ba0a77a4dc..f4cf6ed2f4 100644
--- a/tests/auth_tests/test_views.py
+++ b/tests/auth_tests/test_views.py
@@ -818,9 +818,9 @@ class LoginTest(AuthViewsTestCase):
# Use POST request to log in
SessionMiddleware(get_response).process_request(req)
CsrfViewMiddleware(get_response).process_view(req, LoginView.as_view(), (), {})
- req.META[
- "SERVER_NAME"
- ] = "testserver" # Required to have redirect work in login view
+ req.META["SERVER_NAME"] = (
+ "testserver" # Required to have redirect work in login view
+ )
req.META["SERVER_PORT"] = 80
resp = CsrfViewMiddleware(LoginView.as_view())(req)
csrf_cookie = resp.cookies.get(settings.CSRF_COOKIE_NAME, None)