python-trezor/tests/common.py

36 lines
1.6 KiB
Python
Raw Normal View History

import unittest
import config
from trezorlib.client import TrezorDebugClient
from trezorlib.api_blockchain import BlockchainApi
2013-09-12 20:28:56 -07:00
class TrezorTest(unittest.TestCase):
def setUp(self):
self.debug_transport = config.DEBUG_TRANSPORT(*config.DEBUG_TRANSPORT_ARGS, **config.DEBUG_TRANSPORT_KWARGS)
self.transport = config.TRANSPORT(*config.TRANSPORT_ARGS, **config.TRANSPORT_KWARGS)
self.client = TrezorDebugClient(self.transport)
self.client.set_debuglink(self.debug_transport)
self.client.set_tx_func(BlockchainApi().get_tx)
2013-09-12 20:28:56 -07:00
2014-02-16 16:54:54 -08:00
self.mnemonic12 = 'alcohol woman abuse must during monitor noble actual mixed trade anger aisle'
self.mnemonic18 = 'owner little vague addict embark decide pink prosper true fork panda embody mixture exchange choose canoe electric jewel'
self.mnemonic24 = 'dignity pass list indicate nasty swamp pool script soccer toe leaf photo multiply desk host tomato cradle drill spread actor shine dismiss champion exotic'
2013-09-12 20:28:56 -07:00
2014-02-16 16:54:54 -08:00
self.pin4 = '1234'
self.pin6 = '789456'
self.pin8 = '45678978'
2013-09-12 20:28:56 -07:00
2014-02-16 16:54:54 -08:00
self.client.wipe_device()
2013-09-12 20:28:56 -07:00
print "Setup finished"
print "--------------"
2014-02-16 16:54:54 -08:00
def setup_mnemonic_nopin_nopassphrase(self):
self.client.load_device_by_mnemonic(mnemonic=self.mnemonic12, pin='', passphrase_protection=False, label='test', language='english')
def setup_mnemonic_pin_passphrase(self):
self.client.load_device_by_mnemonic(mnemonic=self.mnemonic12, pin=self.pin4, passphrase_protection=True, label='test', language='english')
def tearDown(self):
self.client.close()