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.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/other/test_configparser.py b/tests/other/test_configparser.py
new file mode 100644
index 000000000..09b686738
--- /dev/null
+++ b/tests/other/test_configparser.py
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+
+from nose.tools import raises
+
+from tests.helper.Stubs import Core
+
+from module.config.ConfigParser import ConfigParser
+
+class TestConfigParser():
+
+ @classmethod
+ def setUpClass(cls):
+ # Only needed to get imports right
+ cls.core = Core()
+ cls.config = ConfigParser()
+
+ def test_dict(self):
+
+ assert self.config["general"]["language"]
+ self.config["general"]["language"] = "de"
+ assert self.config["general"]["language"] == "de"
+
+ def test_contains(self):
+
+ assert "general" in self.config
+ assert "foobaar" not in self.config
+
+ def test_iter(self):
+ for section, config, values in self.config.iterSections():
+ assert isinstance(section, basestring)
+ assert isinstance(config.config, dict)
+ assert isinstance(values, dict)
+
+ @raises(KeyError)
+ def test_invalid_config(self):
+ print self.config["invalid"]["config"]
+
+ @raises(KeyError)
+ def test_invalid_section(self):
+ print self.config["general"]["invalid"] \ No newline at end of file