Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
test: User Admin test case
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizaMaluf committed Nov 1, 2023
1 parent 0991d5f commit d39d725
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion apps/users/tests_users.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.test import TestCase

from .admin import UserAdmin
from .models import User


Expand Down Expand Up @@ -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)

0 comments on commit d39d725

Please sign in to comment.