41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
"""
|
|
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
|