Tests
- Improved directory structure - Added functional and unit tests
This commit is contained in:
40
api/tests/unit/test_user.py
Normal file
40
api/tests/unit/test_user.py
Normal file
@@ -0,0 +1,40 @@
|
||||
"""
|
||||
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
|
Reference in New Issue
Block a user