summaryrefslogtreecommitdiffstats
path: root/tests/manager/test_configManager.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-01-06 15:54:52 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-01-06 15:54:52 +0100
commit6f8b5347dfa119a3df21f4ca8ba8c2b1537a726a (patch)
tree627c4d99f0aaa4c8022b70b3ebe72f201d924dd6 /tests/manager/test_configManager.py
parentremoved unneeded stuff (diff)
downloadpyload-6f8b5347dfa119a3df21f4ca8ba8c2b1537a726a.tar.xz
first working parts of config api
Diffstat (limited to 'tests/manager/test_configManager.py')
-rw-r--r--tests/manager/test_configManager.py26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/manager/test_configManager.py b/tests/manager/test_configManager.py
index 1cfb6a5de..0fed702c1 100644
--- a/tests/manager/test_configManager.py
+++ b/tests/manager/test_configManager.py
@@ -27,6 +27,9 @@ class TestConfigManager(TestCase):
def setUp(self):
self.db.clearAllConfigs()
+ # used by some tests, needs to be deleted
+ self.config.delete("plugin", adminUser)
+
def addConfig(self):
self.config.addConfigSection("plugin", "Name", "desc", "something",
@@ -42,10 +45,12 @@ class TestConfigManager(TestCase):
d = self.db.loadAllConfigs()
assert d[0]["plugin"] == "some value"
+ assert self.db.loadConfigsForUser(0)["plugin"] == "some value"
self.db.deleteConfig("plugin", 0)
assert 0 not in self.db.loadAllConfigs()
+ assert "plugin" not in self.db.loadConfigsForUser(0)
self.db.deleteConfig("plugin")
@@ -86,7 +91,26 @@ class TestConfigManager(TestCase):
def test_sections(self):
- pass
+ self.addConfig()
+
+ i = 0
+ # there should be only one section, with no values
+ for name, config, values in self.config.iterSections(adminUser):
+ assert name == "plugin"
+ assert values == {}
+ i +=1
+ assert i == 1
+
+ assert self.config.set("plugin", "value", True, user=adminUser)
+
+ i = 0
+ # now we assert the correct values
+ for name, config, values in self.config.iterSections(adminUser):
+ assert name == "plugin"
+ assert values == {"value":True}
+ i +=1
+ assert i == 1
+
@raises(InvalidConfigSection)
def test_restricted_access(self):