cic-internal-integration/apps/cic-cache/tests/test_api.py

32 lines
670 B
Python
Raw Normal View History

2021-05-18 13:20:02 +02:00
# standard imports
import json
2021-05-18 18:16:02 +02:00
# external imports
import pytest
2021-05-18 13:20:02 +02:00
# local imports
from cic_cache.runnable.daemons.query import process_transactions_all_data
def test_api_all_data(
init_database,
txs,
):
env = {
2021-05-18 18:16:02 +02:00
'PATH_INFO': '/txa/410000/420000',
2021-05-18 13:20:02 +02:00
'HTTP_X_CIC_CACHE_MODE': 'all',
}
j = process_transactions_all_data(init_database, env)
o = json.loads(j[1])
assert len(o['data']) == 2
2021-05-18 18:16:02 +02:00
env = {
'PATH_INFO': '/txa/420000/410000',
'HTTP_X_CIC_CACHE_MODE': 'all',
}
with pytest.raises(ValueError):
j = process_transactions_all_data(init_database, env)