forked from DGNum/gestioCOF
Clean code related to kfet password
This commit is contained in:
parent
1d19d1797c
commit
e5d19811e8
4 changed files with 46 additions and 14 deletions
25
kfet/tests/test_models.py
Normal file
25
kfet/tests/test_models.py
Normal file
|
@ -0,0 +1,25 @@
|
|||
from django.contrib.auth import get_user_model
|
||||
from django.test import TestCase
|
||||
|
||||
from kfet.models import Account
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class AccountTests(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.account = Account(trigramme='000')
|
||||
self.account.save({'username': 'user'})
|
||||
|
||||
def test_password(self):
|
||||
self.account.change_pwd('anna')
|
||||
self.account.save()
|
||||
|
||||
self.assertEqual(Account.objects.get_by_password('anna'), self.account)
|
||||
|
||||
with self.assertRaises(Account.DoesNotExist):
|
||||
Account.objects.get_by_password(None)
|
||||
|
||||
with self.assertRaises(Account.DoesNotExist):
|
||||
Account.objects.get_by_password('bernard')
|
Loading…
Add table
Add a link
Reference in a new issue