2022-04-12 07:50:24 +00:00
|
|
|
__author__ = "Florian Kaiser"
|
|
|
|
__copyright__ = "Copyright 2022, Project Aktienbot"
|
|
|
|
__credits__ = ["Florian Kaiser", "Florian Kellermann", "Linus Eickhof", "Kevin Pauer"]
|
|
|
|
__license__ = "GPL 3.0"
|
|
|
|
__version__ = "1.0.0"
|
|
|
|
|
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
|