From 7424cf2834f5d7ee3a3106d53897bb72d963bee3 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 9 May 2013 22:29:04 +0100 Subject: [PATCH] Fix error in previous commit (b6a3161) and added test --- deluge/core/core.py | 2 +- deluge/tests/test_core.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/deluge/core/core.py b/deluge/core/core.py index 2347f7786..8637670b2 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -485,7 +485,7 @@ class Core(component.Component): @export def get_config_values(self, keys): """Get the config values for the entered keys""" - return {(key, self.config.get(key)) for key in keys} + return dict((key, self.config.get(key)) for key in keys) @export def set_config(self, config): diff --git a/deluge/tests/test_core.py b/deluge/tests/test_core.py index 4c4f16f51..38f4fdac2 100644 --- a/deluge/tests/test_core.py +++ b/deluge/tests/test_core.py @@ -201,3 +201,10 @@ class CoreTestCase(unittest.TestCase): for key in pathlist: self.assertEquals(deluge.core.torrent.sanitize_filepath(key, folder=False), pathlist[key]) self.assertEquals(deluge.core.torrent.sanitize_filepath(key, folder=True), pathlist[key] + '/') + + def test_get_set_config_values(self): + self.assertEquals(self.core.get_config_values(["abc", "foo"]), {"foo": None, "abc": None}) + self.assertEquals(self.core.get_config_value("foobar"), None) + self.core.set_config({"abc": "def", "foo": 10, "foobar": "barfoo"}) + self.assertEquals(self.core.get_config_values(["foo", "abc"]), {"foo": 10, "abc": "def"}) + self.assertEquals(self.core.get_config_value("foobar"), "barfoo")