authorization routes and logic

This commit is contained in:
Bryan Bailey
2022-04-06 01:24:06 -04:00
parent 5ca91452ca
commit be4eda6686
13 changed files with 205 additions and 6 deletions

26
tests/test_model_user.py Normal file
View File

@@ -0,0 +1,26 @@
import unittest
from app.models import User
class UserModelTestCase(unittest.TestCase):
def test_password_setter(self):
u = User(password='abcdefg')
self.assertTrue(u.password_hash is not None)
def test_no_password_getter(self):
u = User(password='abcdefg')
with self.assertRaises(AttributeError):
u.password
def test_password_verification(self):
u = User(password='abcdefg')
self.assertTrue(u.verify_password('abcdefg'))
self.assertFalse(u.verify_password('password'))
def test_password_salts_are_random(self):
u = User(password='abcdefg')
u2 = User(password='abcdefg')
self.assertTrue(u.password_hash != u2.password_hash)