return value and more tests

This commit is contained in:
jessop 2019-11-22 16:20:24 -05:00 committed by Lex Berezhny
parent 1676246743
commit 4b1492be0d
2 changed files with 7 additions and 3 deletions

View file

@ -1022,7 +1022,8 @@ class Daemon(metaclass=JSONRPCServerType):
"""
with self.conf.update_config() as c:
setattr(c, key, NOT_SET)
return
setting = self.conf.settings_dict[key]
return {key: setting}
PREFERENCE_DOC = """
Preferences management.

View file

@ -19,13 +19,16 @@ class SettingsManagement(CommandTestCase):
self.assertEqual(settings['lbryum_servers'][0],('127.0.0.1', 50001))
servers = ['server:50001', 'server2:50001']
self.daemon.jsonrpc_settings_set('lbryum_servers', servers)
setting = self.daemon.jsonrpc_settings_set('lbryum_servers', servers)
self.assertEqual(setting['lbryum_servers'][0], ('server', 50001))
self.daemon.jsonrpc_settings_set('use_upnp', True)
settings2 = self.daemon.jsonrpc_settings_get()
self.assertEqual(settings2['lbryum_servers'][0], ('server', 50001))
self.assertEqual(settings2['use_upnp'], True)
self.daemon.jsonrpc_settings_clear('lbryum_servers')
clearing = self.daemon.jsonrpc_settings_clear('lbryum_servers')
self.assertEqual(clearing['lbryum_servers'][0], ('spv1.lbry.com', 50001))
settings3 = self.daemon.jsonrpc_settings_get()
self.assertNotEqual(settings3['lbryum_servers'][0], ('spv1.lbry.com', 50002))
self.assertEqual(settings3['lbryum_servers'][0], ('spv1.lbry.com', 50001))