2022-03-30 08:46:54 +00:00
|
|
|
"""
|
|
|
|
This file (test_helper_functions.py) contains the unit tests for the helper_functions.py file.
|
|
|
|
"""
|
|
|
|
from app.helper_functions import *
|
|
|
|
|
|
|
|
|
|
|
|
def test_hash_password():
|
|
|
|
"""
|
|
|
|
Test hash_password function
|
|
|
|
"""
|
|
|
|
assert hash_password("password") != "password"
|
|
|
|
|
|
|
|
|
|
|
|
def test_check_password():
|
|
|
|
"""
|
|
|
|
Test check_password function
|
|
|
|
"""
|
|
|
|
hashed = hash_password("password")
|
|
|
|
assert check_password(hashed, "password".encode("utf-8")) is True
|
|
|
|
assert check_password(hashed, "password1".encode("utf-8")) is False
|
2022-04-05 08:51:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_get_email_from_token():
|
|
|
|
"""
|
|
|
|
Test get_email_from_token function
|
|
|
|
"""
|
|
|
|
assert get_email_from_token_data(None) is None
|