new apps.lyric.authenticate model PasswordlessAuthenticationBackend and authenticate() function help determine Token authenticity, login to existing accounts, or create new ones; associated .tests.test_authentication class asserts this functionality; apps.lyric.models & .tests.models now handles token uid instead of id, completing the transition away from email-as-pk
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import uuid
|
||||
from django.contrib import auth
|
||||
from django.test import TestCase
|
||||
from ..models import Token, User
|
||||
@@ -16,6 +17,7 @@ class UserModelTest(TestCase):
|
||||
|
||||
class TokenModelTest(TestCase):
|
||||
def test_links_user_with_autogen_uid(self):
|
||||
token1 = Token.objects.create(id="123")
|
||||
token2 = Token.objects.create(id="124")
|
||||
self.assertNotEqual(token1.uid, token2.uid)
|
||||
token1 = Token.objects.create(email="a@b.cde")
|
||||
token2 = Token.objects.create(email="v@w.xyz")
|
||||
self.assertNotEqual(token1.pk, token2.pk)
|
||||
self.assertIsInstance(token1.pk, uuid.UUID)
|
||||
|
||||
Reference in New Issue
Block a user