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