summaryrefslogtreecommitdiff
path: root/tests/auth_tests/models
diff options
context:
space:
mode:
authorJon Janzen <jon@jonjanzen.com>2024-03-31 12:29:10 -0700
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-10-07 14:19:41 +0200
commit50f89ae850f6b4e35819fe725a08c7e579bfd099 (patch)
tree856a0e954e0be928c55f6070f2ac8b766459b3e7 /tests/auth_tests/models
parent4cad317ff1f9a79d54c1d5b12f1ccbd260ca009f (diff)
Fixed #35303 -- Implemented async auth backends and utils.
Diffstat (limited to 'tests/auth_tests/models')
-rw-r--r--tests/auth_tests/models/custom_user.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auth_tests/models/custom_user.py b/tests/auth_tests/models/custom_user.py
index b9938681ca..4586e452cd 100644
--- a/tests/auth_tests/models/custom_user.py
+++ b/tests/auth_tests/models/custom_user.py
@@ -29,6 +29,19 @@ class CustomUserManager(BaseUserManager):
user.save(using=self._db)
return user
+ async def acreate_user(self, email, date_of_birth, password=None, **fields):
+ """See create_user()"""
+ if not email:
+ raise ValueError("Users must have an email address")
+
+ user = self.model(
+ email=self.normalize_email(email), date_of_birth=date_of_birth, **fields
+ )
+
+ user.set_password(password)
+ await user.asave(using=self._db)
+ return user
+
def create_superuser(self, email, password, date_of_birth, **fields):
u = self.create_user(
email, password=password, date_of_birth=date_of_birth, **fields