Fix error in previous commit (b6a3161) and added test

This commit is contained in:
Calum Lind 2013-05-09 22:29:04 +01:00
parent b6a3161280
commit 7424cf2834
2 changed files with 8 additions and 1 deletions

View File

@ -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):

View File

@ -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")