tests: refactor --testnet in self.dev_args to __init__

This commit is contained in:
Andrew Chow 2020-08-19 13:22:49 -04:00
parent 8751d1c725
commit 79f74a78fc
3 changed files with 7 additions and 9 deletions

View File

@ -65,7 +65,7 @@ class DeviceTestCase(unittest.TestCase):
self.fingerprint = fingerprint
self.master_xpub = master_xpub
self.password = password
self.dev_args = ['-t', self.type, '-d', self.path]
self.dev_args = ['-t', self.type, '-d', self.path, '--testnet']
if emulator:
self.emulator = emulator
else:
@ -172,8 +172,6 @@ class TestGetKeypool(DeviceTestCase):
self.rpc.createwallet('{}_test'.format(self.full_type), True)
self.wrpc = AuthServiceProxy('http://{}@127.0.0.1:18443/wallet/{}_test'.format(self.rpc_userpass, self.full_type))
self.wpk_rpc = AuthServiceProxy('http://{}@127.0.0.1:18443/wallet/'.format(self.rpc_userpass))
if '--testnet' not in self.dev_args:
self.dev_args.append('--testnet')
self.emulator.start()
def test_getkeypool(self):
@ -249,8 +247,6 @@ class TestGetKeypool(DeviceTestCase):
class TestGetDescriptors(DeviceTestCase):
def setUp(self):
self.rpc = AuthServiceProxy('http://{}@127.0.0.1:18443'.format(self.rpc_userpass))
if '--testnet' not in self.dev_args:
self.dev_args.append('--testnet')
self.emulator.start()
def tearDown(self):
@ -281,8 +277,6 @@ class TestSignTx(DeviceTestCase):
self.rpc.createwallet('{}_test'.format(self.full_type), True)
self.wrpc = AuthServiceProxy('http://{}@127.0.0.1:18443/wallet/{}_test'.format(self.rpc_userpass, self.full_type))
self.wpk_rpc = AuthServiceProxy('http://{}@127.0.0.1:18443/wallet/'.format(self.rpc_userpass))
if '--testnet' not in self.dev_args:
self.dev_args.append('--testnet')
self.emulator.start()
def _generate_and_finalize(self, unknown_inputs, psbt):
@ -462,8 +456,6 @@ class TestDisplayAddress(DeviceTestCase):
self.rpc.createwallet('{}_test'.format(self.full_type), True)
self.wrpc = AuthServiceProxy('http://{}@127.0.0.1:18443/wallet/{}_test'.format(self.rpc_userpass, self.full_type))
self.wpk_rpc = AuthServiceProxy('http://{}@127.0.0.1:18443/wallet/'.format(self.rpc_userpass))
if '--testnet' not in self.dev_args:
self.dev_args.append('--testnet')
self.emulator.start()
def test_display_address_bad_args(self):

View File

@ -133,6 +133,9 @@ def digitalbitbox_test_suite(simulator, rpc, userpass, interface):
self.assertTrue(result['success'])
class TestBitboxGetXpub(DeviceTestCase):
def setUp(self):
self.dev_args.remove('--testnet')
def test_getxpub(self):
result = self.do_command(self.dev_args + ['--expert', 'getxpub', 'm/44h/0h/0h/3'])
self.assertEqual(result['xpub'], 'xpub6Du9e5Cz1NZWz3dvsvM21tsj4xEdbAb7AcbysFL42Y3yr8PLMnsaxhetHxurTpX5Rp5RbnFFwP1wct8K3gErCUSwcxFhxThsMBSxdmkhTNf')

View File

@ -99,6 +99,9 @@ def ledger_test_suite(emulator, rpc, userpass, interface):
self.assertEqual(result['code'], -9)
class TestLedgerGetXpub(DeviceTestCase):
def setUp(self):
self.dev_args.remove("--testnet")
def test_getxpub(self):
result = self.do_command(self.dev_args + ['--expert', 'getxpub', 'm/44h/0h/0h/3'])
self.assertEqual(result['xpub'], 'xpub6DqTtMuqBiBsSPb5UxB1qgJ3ViXuhoyZYhw3zTK4MywLB6psioW4PN1SAbhxVVirKQojnTBsjG5gXiiueRBgWmUuN43dpbMSgMCQHVqx2bR')