diff --git a/apps/users/tests_users.py b/apps/users/tests_users.py index 655debe..073f21e 100644 --- a/apps/users/tests_users.py +++ b/apps/users/tests_users.py @@ -1,5 +1,6 @@ from django.test import TestCase +from .admin import UserAdmin from .models import User @@ -44,4 +45,36 @@ def test_create_superuser(self) -> None: class UserAdminTestCase(TestCase): - pass + def test_list_display(self) -> None: + self.assertEqual( + UserAdmin.list_display, + ("username", "email", "is_staff", "is_active"), + ) + + def test_fieldsets(self) -> None: + expected_fieldsets = [ + (("Personal info"), {"fields": ("username", "email", "password")}), + ( + ("Permissions"), + { + "fields": ( + "user_permissions", + "groups", + "is_active", + "is_staff", + "is_superuser", + ) + }, + ), + ] + self.assertEqual(UserAdmin.fieldsets, expected_fieldsets) + + def test_add_fieldsets(self) -> None: + expected_add_fieldsets = ( + None, + { + "classes": ("wide",), + "fields": ("username", "email", "passord1", "password2"), + }, + ) + self.assertEqual(UserAdmin.add_fieldsets, expected_add_fieldsets)