summaryrefslogtreecommitdiffstats
path: root/tests/other/test_configparser.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/other/test_configparser.py')
-rw-r--r--tests/other/test_configparser.py50
1 files changed, 16 insertions, 34 deletions
diff --git a/tests/other/test_configparser.py b/tests/other/test_configparser.py
index acb05c63e..51ffc5a68 100644
--- a/tests/other/test_configparser.py
+++ b/tests/other/test_configparser.py
@@ -1,44 +1,18 @@
# -*- coding: utf-8 -*-
-from collections import defaultdict
+from nose.tools import raises
+
from tests.helper.Stubs import Core
-from module.database import DatabaseBackend
from module.config.ConfigParser import ConfigParser
-# TODO
class TestConfigParser():
- db = None
-
@classmethod
def setUpClass(cls):
- cls.db = DatabaseBackend(Core())
- cls.db.manager = cls.db.core
- cls.db.manager.statusMsg = defaultdict(lambda: "statusmsg")
+ # Only needed to get imports right
+ cls.core = Core()
cls.config = ConfigParser()
- cls.db.setup()
- cls.db.clearAllConfigs()
-
- @classmethod
- def tearDownClass(cls):
- cls.db.shutdown()
-
- def test_db(self):
-
- self.db.saveConfig("plugin", "some value", 0)
- self.db.saveConfig("plugin", "some other value", 1)
-
- assert self.db.loadConfig("plugin", 0) == "some value"
- assert self.db.loadConfig("plugin", 1) == "some other value"
-
- d = self.db.loadAllConfigs()
- assert d[0]["plugin"] == "some value"
-
- self.db.deleteConfig("plugin")
-
- assert not self.db.loadAllConfigs()
-
def test_dict(self):
@@ -46,8 +20,16 @@ class TestConfigParser():
self.config["general"]["language"] = "de"
assert self.config["general"]["language"] == "de"
- def test_config(self):
- pass
+ def test_contains(self):
+
+ assert "general" in self.config
+ assert "foobaar" not in self.config
+
+
+ @raises(KeyError)
+ def test_invalid_config(self):
+ print self.config["invalid"]["config"]
- def test_userconfig(self):
- pass \ No newline at end of file
+ @raises(KeyError)
+ def test_invalid_section(self):
+ print self.config["general"]["invalid"] \ No newline at end of file