summaryrefslogtreecommitdiff
path: root/tests/auth_tests/models/custom_user.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auth_tests/models/custom_user.py')
-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