Fix error in previous commit (b6a3161
) and added test
This commit is contained in:
parent
b6a3161280
commit
7424cf2834
|
@ -485,7 +485,7 @@ class Core(component.Component):
|
||||||
@export
|
@export
|
||||||
def get_config_values(self, keys):
|
def get_config_values(self, keys):
|
||||||
"""Get the config values for the entered 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
|
@export
|
||||||
def set_config(self, config):
|
def set_config(self, config):
|
||||||
|
|
|
@ -201,3 +201,10 @@ class CoreTestCase(unittest.TestCase):
|
||||||
for key in pathlist:
|
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=False), pathlist[key])
|
||||||
self.assertEquals(deluge.core.torrent.sanitize_filepath(key, folder=True), 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")
|
||||||
|
|
Loading…
Reference in New Issue