108536490: Update encryption for password

This commit is contained in:
Rebecca Law
2015-11-30 15:33:40 +00:00
parent 3f017b30f2
commit ff9e98907e
6 changed files with 27 additions and 16 deletions

View File

@@ -1,9 +1,17 @@
from app.main import encryption
from app.main.encryption import hashpw, checkpw
def test_encryption(notifications_admin):
def test_should_hash_password():
password = 'passwordToHash'
assert password != hashpw(password)
def test_should_check_password():
value = 's3curePassword!'
encrypted = hashpw(value)
assert checkpw(value, encrypted) is True
encrypted = encryption.encrypt(value)
assert encrypted == encryption.encrypt(value)
def test_checkpw_should_fail_when_pw_does_not_match():
value = hashpw('somePassword')
assert checkpw('somethingDifferent', value) is False