23 lines
687 B
Python
23 lines
687 B
Python
import logging
|
|
|
|
import pytest
|
|
|
|
from wcs_olap.feeder import WcsOlapFeeder
|
|
|
|
|
|
def test_constructor():
|
|
feeder = WcsOlapFeeder(api=None, pg_dsn='', schema='x' * 63)
|
|
schema_temp = feeder.ctx.as_dict()['schema_temp']
|
|
assert len(schema_temp) < 64
|
|
assert schema_temp == 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxedd110xxxxxxxxxxxxxxxxxxxxxxxx_temp'
|
|
|
|
with pytest.raises(ValueError):
|
|
feeder = WcsOlapFeeder(api=None, pg_dsn='', schema='x' * 64)
|
|
|
|
|
|
def test_sql_error_logging(caplog):
|
|
feeder = WcsOlapFeeder(api=None, pg_dsn='', schema='x' * 63, logger=logging.getLogger())
|
|
with pytest.raises(Exception):
|
|
feeder.ex('COIN')
|
|
assert 'Failed to execute' in caplog.text
|