56 lines
1.8 KiB
Python
56 lines
1.8 KiB
Python
__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"
|
|
|
|
"""
|
|
This file (test_helper_functions.py) contains the unit tests for the helper_functions.py file.
|
|
"""
|
|
from app.blueprints.user import *
|
|
|
|
|
|
def test_check_if_email_data_exists():
|
|
"""
|
|
Test check_if_email_data_exists function
|
|
"""
|
|
assert check_if_email_data_exists(dict(email='user@example.com')) is True
|
|
assert check_if_email_data_exists(dict(email='')) is False
|
|
assert check_if_email_data_exists(dict()) is False
|
|
|
|
|
|
def test_check_if_password_data_exists():
|
|
"""
|
|
Test check_if_password_data_exists function
|
|
"""
|
|
assert check_if_password_data_exists(dict(password='password')) is True
|
|
assert check_if_password_data_exists(dict(password='')) is False
|
|
assert check_if_password_data_exists(dict()) is False
|
|
|
|
|
|
def test_check_if_username_data_exists():
|
|
"""
|
|
Test check_if_username_data_exists function
|
|
"""
|
|
assert check_if_username_data_exists(dict(username='user')) is True
|
|
assert check_if_username_data_exists(dict(username='')) is False
|
|
assert check_if_username_data_exists(dict()) is False
|
|
|
|
|
|
def test_check_if_admin_data_exists():
|
|
"""
|
|
Test check_if_admin_data_exists function
|
|
"""
|
|
assert check_if_admin_data_exists(dict(admin=True)) is True
|
|
assert check_if_admin_data_exists(dict(admin=None)) is False
|
|
assert check_if_admin_data_exists(dict()) is False
|
|
|
|
|
|
def test_check_if_cron_data_exists():
|
|
"""
|
|
Test check_if_cron_data_exists function
|
|
"""
|
|
assert check_if_cron_data_exists(dict(cron="* * * * *")) is True
|
|
assert check_if_cron_data_exists(dict(cron="")) is False
|
|
assert check_if_cron_data_exists(dict()) is False
|