summaryrefslogtreecommitdiff
path: root/tests/admin_views/test_forms.py
diff options
context:
space:
mode:
authorsaeedblanchette <saiidblanchettel@outlook.com>2021-06-08 17:00:00 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2021-06-10 12:47:53 +0200
commit66ed03e7c9ae4cd754aa918c6f4c9227cf424141 (patch)
treec8df099f407702b7552d7421a8b2defdbbe01138 /tests/admin_views/test_forms.py
parentcb6c19749d342c3dc0f97d89ff6887b220cf45b8 (diff)
Refs #24121 -- Added __repr__() to AdminForm, BlockContext, BlockTranslateNode, and IncludeNode.
Diffstat (limited to 'tests/admin_views/test_forms.py')
-rw-r--r--tests/admin_views/test_forms.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/tests/admin_views/test_forms.py b/tests/admin_views/test_forms.py
index d4eecf48aa..f9a56c02af 100644
--- a/tests/admin_views/test_forms.py
+++ b/tests/admin_views/test_forms.py
@@ -1,6 +1,9 @@
from django.contrib.admin.forms import AdminAuthenticationForm
+from django.contrib.admin.helpers import AdminForm
from django.contrib.auth.models import User
-from django.test import TestCase, override_settings
+from django.test import SimpleTestCase, TestCase, override_settings
+
+from .admin import ArticleForm
# To verify that the login form rejects inactive users, use an authentication
@@ -18,3 +21,21 @@ class AdminAuthenticationFormTests(TestCase):
}
form = AdminAuthenticationForm(None, data)
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'),
+ }),
+ )
+ form = ArticleForm()
+ admin_form = AdminForm(form, fieldsets, {})
+ self.assertEqual(
+ repr(admin_form),
+ "<AdminForm: form=ArticleForm fieldsets=(('My fields', "
+ "{'classes': ['collapse'], "
+ "'fields': ('url', 'title', 'content', 'sites')}),)>",
+ )