lbry-sdk/lbry/tests/integration/test_other_commands.py
2019-11-22 22:28:55 -05:00

34 lines
1.5 KiB
Python

from lbry.testcase import CommandTestCase
class AddressManagement(CommandTestCase):
async def test_address_list(self):
addresses = await self.out(self.daemon.jsonrpc_address_list())
self.assertItemCount(addresses, 27)
single = await self.out(self.daemon.jsonrpc_address_list(addresses['items'][11]['address']))
self.assertItemCount(single, 1)
self.assertEqual(single['items'][0], addresses['items'][11])
class SettingsManagement(CommandTestCase):
async def test_settings(self):
settings = self.daemon.jsonrpc_settings_get()
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', 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)
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))