custom user model that maintains id as pk
This commit is contained in:
0
src/apps/lyric/tests/__init__.py
Normal file
0
src/apps/lyric/tests/__init__.py
Normal file
15
src/apps/lyric/tests/test_models.py
Normal file
15
src/apps/lyric/tests/test_models.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from django.contrib import auth
|
||||
from django.test import TestCase
|
||||
from ..models import User
|
||||
|
||||
class UserModelTest(TestCase):
|
||||
def test_model_is_configured_for_django_auth(self):
|
||||
self.assertEqual(auth.get_user_model(), User)
|
||||
|
||||
def test_user_is_valid_with_email_only(self):
|
||||
user = User(email="a@b.cde")
|
||||
user.full_clean() # should not raise
|
||||
|
||||
def test_id_is_primary_key(self):
|
||||
user = User(id="123")
|
||||
self.assertEqual(user.pk, "123")
|
||||
Reference in New Issue
Block a user