mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 10:53:28 -05:00
108536490: Update encryption for password
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user