2016-05-09 20:09:16 +02:00
|
|
|
import pytest
|
2015-07-13 21:35:05 +02:00
|
|
|
|
2016-08-06 21:39:36 +02:00
|
|
|
from tsstats.config import load
|
2015-09-04 23:20:35 +02:00
|
|
|
|
2015-07-13 21:35:05 +02:00
|
|
|
|
2016-05-09 20:09:16 +02:00
|
|
|
@pytest.fixture
|
2017-02-22 22:00:09 +01:00
|
|
|
def config():
|
|
|
|
return load()
|
2015-07-13 21:35:05 +02:00
|
|
|
|
|
|
|
|
2016-05-09 20:09:16 +02:00
|
|
|
def test_config(config):
|
2017-02-22 22:00:09 +01:00
|
|
|
assert not config.getboolean('General', 'debug')
|
|
|
|
assert config.getboolean('General', 'onlinedc')
|
|
|
|
config.set('General', 'idmap', 'tsstats/tests/res/id_map.json')
|
|
|
|
assert config.get('General', 'idmap') ==\
|
2016-08-06 21:39:36 +02:00
|
|
|
'tsstats/tests/res/id_map.json'
|
2017-02-22 22:00:09 +01:00
|
|
|
config.set('General', 'log', 'tsstats/tests/res/test.log')
|
|
|
|
assert config.get('General', 'log') == 'tsstats/tests/res/test.log'
|
|
|
|
config.set('General', 'output', 'output.html')
|
|
|
|
assert config.get('General', 'output') == 'output.html'
|
2017-02-23 21:38:59 +01:00
|
|
|
|
|
|
|
|
|
|
|
def test_read():
|
|
|
|
config = load(path='tsstats/tests/res/config.ini')
|
|
|
|
# test defaults
|
|
|
|
assert not config.getboolean('General', 'debug')
|
|
|
|
# test written values
|
|
|
|
assert config.get('General', 'log') == 'tsstats/tests/res/test.log'
|
|
|
|
assert config.get('General', 'output') == 'tsstats/tests/res/output.html'
|