From 560958b70043ea5b7e0e32d41cb51bd44696d775 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 9 Sep 2012 15:39:50 +0200 Subject: new config api --- tests/test_configparser.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/test_configparser.py (limited to 'tests/test_configparser.py') diff --git a/tests/test_configparser.py b/tests/test_configparser.py new file mode 100644 index 000000000..29ba9e51b --- /dev/null +++ b/tests/test_configparser.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +from collections import defaultdict +from helper.Stubs import Core + +from module.database import DatabaseBackend +from module.config.ConfigParser import ConfigParser + +# TODO +class TestConfigParser(): + + @classmethod + def setUpClass(cls): + cls.db = DatabaseBackend(Core()) + cls.db.manager = cls.db.core + cls.db.manager.statusMsg = defaultdict(lambda: "statusmsg") + cls.config = ConfigParser + + + def test_db(self): + pass + + def test_dict(self): + pass + + def test_config(self): + pass + + def test_userconfig(self): + pass \ No newline at end of file -- cgit v1.2.3 From 54bc92b4c5e0b3543a313f497cbc2276403c5980 Mon Sep 17 00:00:00 2001 From: RaNaN Date: Mon, 10 Sep 2012 11:49:35 +0200 Subject: changed config + progress api --- tests/test_configparser.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'tests/test_configparser.py') diff --git a/tests/test_configparser.py b/tests/test_configparser.py index 29ba9e51b..d797c7912 100644 --- a/tests/test_configparser.py +++ b/tests/test_configparser.py @@ -14,14 +14,32 @@ class TestConfigParser(): cls.db = DatabaseBackend(Core()) cls.db.manager = cls.db.core cls.db.manager.statusMsg = defaultdict(lambda: "statusmsg") - cls.config = ConfigParser + cls.config = ConfigParser() + cls.db.setup() + cls.db.clearAllConfigs() def test_db(self): - pass + + 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): - pass + + assert self.config["general"]["language"] + self.config["general"]["language"] = "de" + assert self.config["general"]["language"] == "de" def test_config(self): pass -- cgit v1.2.3