mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-05 10:53:28 -05:00
109526036: Updates as per comments made on pull request.
This commit is contained in:
@@ -2,7 +2,7 @@ import sqlalchemy
|
||||
from pytest import fail
|
||||
|
||||
from app.main.dao import verify_codes_dao
|
||||
from app.main.encryption import checkpw
|
||||
from app.main.encryption import check_hash
|
||||
from tests.app.main import create_test_user
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ def test_insert_new_code_and_get_it_back(notifications_admin, notifications_admi
|
||||
verify_codes_dao.add_code(user_id=user.id, code='12345', code_type='email')
|
||||
saved_code = verify_codes_dao.get_code(user_id=user.id, code_type='email')
|
||||
assert saved_code.user_id == user.id
|
||||
assert checkpw('12345', saved_code.code)
|
||||
assert check_hash('12345', saved_code.code)
|
||||
assert saved_code.code_type == 'email'
|
||||
assert saved_code.code_used is False
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from app.main.encryption import hashpw, checkpw
|
||||
from app.main.encryption import hashpw, check_hash
|
||||
|
||||
|
||||
def test_should_hash_password():
|
||||
@@ -9,9 +9,9 @@ def test_should_hash_password():
|
||||
def test_should_check_password():
|
||||
value = 's3curePassword!'
|
||||
encrypted = hashpw(value)
|
||||
assert checkpw(value, encrypted) is True
|
||||
assert check_hash(value, encrypted) is True
|
||||
|
||||
|
||||
def test_checkpw_should_fail_when_pw_does_not_match():
|
||||
value = hashpw('somePassword')
|
||||
assert checkpw('somethingDifferent', value) is False
|
||||
assert check_hash('somethingDifferent', value) is False
|
||||
|
||||
Reference in New Issue
Block a user