Tests
- Improved directory structure - Added functional and unit tests
This commit is contained in:
40
api/tests/unit/test_transaction.py
Normal file
40
api/tests/unit/test_transaction.py
Normal file
@@ -0,0 +1,40 @@
|
||||
"""
|
||||
This file (test_transaction.py) contains the unit tests for the blueprints/transaction.py file.
|
||||
"""
|
||||
from app.blueprints.transactions import *
|
||||
|
||||
|
||||
def test_check_if_symbol_data_exists():
|
||||
"""
|
||||
Test check_if_symbol_data_exists function
|
||||
"""
|
||||
assert check_if_symbol_data_exists(dict(symbol='DTEGY')) is True
|
||||
assert check_if_symbol_data_exists(dict(symbol='')) is False
|
||||
assert check_if_symbol_data_exists(dict()) is False
|
||||
|
||||
|
||||
def test_check_if_time_data_exists():
|
||||
"""
|
||||
Test check_if_time_data_exists function
|
||||
"""
|
||||
assert check_if_time_data_exists(dict(time='2022-03-29T10:00:00.000Z')) is True
|
||||
assert check_if_time_data_exists(dict(time='')) is False
|
||||
assert check_if_time_data_exists(dict()) is False
|
||||
|
||||
|
||||
def test_check_if_count_data_exists():
|
||||
"""
|
||||
Test check_if_count_data_exists function
|
||||
"""
|
||||
assert check_if_count_data_exists(dict(count=10)) is True
|
||||
assert check_if_count_data_exists(dict(count=None)) is False
|
||||
assert check_if_count_data_exists(dict()) is False
|
||||
|
||||
|
||||
def test_check_if_price_data_exists():
|
||||
"""
|
||||
Test check_if_price_data_exists function
|
||||
"""
|
||||
assert check_if_price_data_exists(dict(price=9.99)) is True
|
||||
assert check_if_price_data_exists(dict(price=None)) is False
|
||||
assert check_if_price_data_exists(dict()) is False
|
Reference in New Issue
Block a user