Commit 924153b3 authored by Jason Frisvold's avatar Jason Frisvold
Browse files

- Add "bad" config

- Add test for bad parse
parent 0165ca28
broken = true
# Comments in the config file
[client]
configdir = /opt/skynet/config
# Another comment
[server]
dbport = 3306
# And another comment
[gui]
favicon = favicon.ico
......@@ -19,12 +19,10 @@
# * 02110-1301 USA * #
import pytest
import logging
from libs.config import SkynetConfig
from collections import defaultdict
from unittest.mock import patch, mock_open
from textwrap import dedent
from os import path
defaultconfig = {'global':
......@@ -63,6 +61,16 @@ class TestSkynetConfig(object):
assert configobject._section == None
# TODO: Figure out how to mock this and test
def test_broken_instantiate_custom(self, caplog):
dir_path = path.dirname(path.realpath(__file__))
configobject = SkynetConfig(dir_path + '/test.bad.conf')
assert configobject._configfile == dir_path + '/test.bad.conf'
assert configobject._cfg == defaultconfig
assert "Unable to load config file = File contains no section headers." in caplog.text
# TODO: Figure out how to mock this and test
def test_loadconfig(self):
configobject = SkynetConfig()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment