summaryrefslogtreecommitdiff
path: root/tests/admin_views/test_forms.py
diff options
context:
space:
mode:
authordjango-bot <ops@djangoproject.com>2022-02-03 20:24:19 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-07 20:37:05 +0100
commit9c19aff7c7561e3a82978a272ecdaad40dda5c00 (patch)
treef0506b668a013d0063e5fba3dbf4863b466713ba /tests/admin_views/test_forms.py
parentf68fa8b45dfac545cfc4111d4e52804c86db68d3 (diff)
Refs #33476 -- Reformatted code with Black.
Diffstat (limited to 'tests/admin_views/test_forms.py')
-rw-r--r--tests/admin_views/test_forms.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/admin_views/test_forms.py b/tests/admin_views/test_forms.py
index f9a56c02af..91d504b4f9 100644
--- a/tests/admin_views/test_forms.py
+++ b/tests/admin_views/test_forms.py
@@ -8,28 +8,35 @@ from .admin import ArticleForm
# To verify that the login form rejects inactive users, use an authentication
# backend that allows them.
-@override_settings(AUTHENTICATION_BACKENDS=['django.contrib.auth.backends.AllowAllUsersModelBackend'])
+@override_settings(
+ AUTHENTICATION_BACKENDS=["django.contrib.auth.backends.AllowAllUsersModelBackend"]
+)
class AdminAuthenticationFormTests(TestCase):
@classmethod
def setUpTestData(cls):
- User.objects.create_user(username='inactive', password='password', is_active=False)
+ User.objects.create_user(
+ username="inactive", password="password", is_active=False
+ )
def test_inactive_user(self):
data = {
- 'username': 'inactive',
- 'password': 'password',
+ "username": "inactive",
+ "password": "password",
}
form = AdminAuthenticationForm(None, data)
- self.assertEqual(form.non_field_errors(), ['This account is inactive.'])
+ self.assertEqual(form.non_field_errors(), ["This account is inactive."])
class AdminFormTests(SimpleTestCase):
def test_repr(self):
fieldsets = (
- ('My fields', {
- 'classes': ['collapse'],
- 'fields': ('url', 'title', 'content', 'sites'),
- }),
+ (
+ "My fields",
+ {
+ "classes": ["collapse"],
+ "fields": ("url", "title", "content", "sites"),
+ },
+ ),
)
form = ArticleForm()
admin_form = AdminForm(form, fieldsets, {})