Skip to content

Commit

Permalink
test: added check for USERNAME_FIELD
Browse files Browse the repository at this point in the history
  • Loading branch information
InzGIBA committed Mar 28, 2024
1 parent d72dd06 commit ef39889
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,17 @@ def test_deepcopy(self):
user = authenticate(username="Alice", password="password")
user = deepcopy(user)

@_override_settings(AUTH_USER_MODEL="tests.TestUser")
def test_auth_custom_field(self):
self._init_settings(
USER_DN_TEMPLATE="cn=%(user)s,ou=people,o=test",
USER_ATTR_MAP={"identifier": "cn"},
)
charlie = TestUser.objects.create(identifier="charlie_cooper", uid_number=1004)
user = authenticate(identifier="charlie_cooper", password="password")
self.assertIsInstance(user, TestUser)
self.assertEqual(user.identifier, charlie.identifier)

@_override_settings(AUTH_USER_MODEL="tests.TestUser")
def test_auth_custom_user(self):
self._init_settings(
Expand Down

0 comments on commit ef39889

Please sign in to comment.