TeamspeakStats/tsstats/tests/test_config.py

31 lines
976 B
Python
Raw Permalink Normal View History

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