review changes

This commit is contained in:
jessop 2019-11-22 21:41:27 -05:00 committed by Lex Berezhny
parent 4b1492be0d
commit d40461de94
2 changed files with 7 additions and 17 deletions

View file

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

View file

@ -14,21 +14,12 @@ class AddressManagement(CommandTestCase):
class SettingsManagement(CommandTestCase): class SettingsManagement(CommandTestCase):
async def test_settings(self): async def test_settings(self):
settings = self.daemon.jsonrpc_settings_get() self.assertEqual(self.daemon.jsonrpc_settings_get()['lbryum_servers'][0], ('127.0.0.1', 50001))
self.assertNotEqual(settings['lbryum_servers'][0],('127.0.0.1', 50002))
self.assertEqual(settings['lbryum_servers'][0],('127.0.0.1', 50001))
servers = ['server:50001', 'server2:50001'] setting = self.daemon.jsonrpc_settings_set('lbryum_servers', ['server:50001'])
setting = self.daemon.jsonrpc_settings_set('lbryum_servers', servers)
self.assertEqual(setting['lbryum_servers'][0], ('server', 50001)) self.assertEqual(setting['lbryum_servers'][0], ('server', 50001))
self.assertEqual(self.daemon.jsonrpc_settings_get()['lbryum_servers'][0], ('server', 50001))
self.daemon.jsonrpc_settings_set('use_upnp', True) setting = self.daemon.jsonrpc_settings_clear('lbryum_servers')
settings2 = self.daemon.jsonrpc_settings_get() self.assertEqual(setting['lbryum_servers'][0], ('spv1.lbry.com', 50001))
self.assertEqual(settings2['lbryum_servers'][0], ('server', 50001)) self.assertEqual(self.daemon.jsonrpc_settings_get()['lbryum_servers'][0], ('spv1.lbry.com', 50001))
self.assertEqual(settings2['use_upnp'], True)
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))