2017-09-16 16:31:15 -04:00
|
|
|
# -*- coding: utf-8 -*-
|
2016-05-09 14:09:16 -04:00
|
|
|
import pytest
|
2015-07-13 15:35:05 -04:00
|
|
|
|
2016-08-06 15:39:36 -04:00
|
|
|
from tsstats.config import load
|
2015-09-04 17:20:35 -04:00
|
|
|
|
2015-07-13 15:35:05 -04:00
|
|
|
|
2016-05-09 14:09:16 -04:00
|
|
|
@pytest.fixture
|
2017-02-22 16:00:09 -05:00
|
|
|
def config():
|
|
|
|
return load()
|
2015-07-13 15:35:05 -04:00
|
|
|
|
|
|
|
|
2016-05-09 14:09:16 -04:00
|
|
|
def test_config(config):
|
2017-02-22 16:00:09 -05: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 15:39:36 -04:00
|
|
|
'tsstats/tests/res/id_map.json'
|
2017-02-22 16:00:09 -05: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 15:38:59 -05: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'
|