mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +00:00
Tests fixed to work with latest sources
This commit is contained in:
parent
4b9a6675c7
commit
29bd7a10f8
@ -9,11 +9,12 @@ class BitkeyTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.debug_transport = config.DEBUG_TRANSPORT(*config.DEBUG_TRANSPORT_ARGS)
|
||||
self.transport = config.TRANSPORT(*config.TRANSPORT_ARGS)
|
||||
self.bitkey = BitkeyClient(self.transport, DebugLink(self.debug_transport), algo=proto.ELECTRUM, debug=True)
|
||||
self.bitkey = BitkeyClient(self.transport, DebugLink(self.debug_transport), debug=True)
|
||||
|
||||
self.bitkey.setup_debuglink(button=True, pin_correct=True, otp_correct=True)
|
||||
|
||||
self.bitkey.load_device(seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
self.bitkey.load_device(algo=proto.ELECTRUM,
|
||||
seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
otp=True, pin='1234', spv=True)
|
||||
|
||||
print "Setup finished"
|
||||
@ -22,4 +23,4 @@ class BitkeyTest(unittest.TestCase):
|
||||
def tearDown(self):
|
||||
self.bitkey.init_device()
|
||||
self.debug_transport.close()
|
||||
self.transport.close()
|
||||
self.transport.close()
|
||||
|
@ -5,14 +5,17 @@ from bitkeylib.transport_pipe import PipeTransport
|
||||
from bitkeylib.transport_hid import HidTransport
|
||||
from bitkeylib.transport_socket import SocketTransportClient
|
||||
|
||||
#TRANSPORT = PipeTransport
|
||||
#TRANSPORT_ARGS = ('../../bitkey-python/pipe', False)
|
||||
TRANSPORT = HidTransport
|
||||
TRANSPORT_ARGS = ('0x10c4:0xea80:000868D3', False)
|
||||
TRANSPORT = PipeTransport
|
||||
TRANSPORT_ARGS = ('../../bitkey-python/bitkey.pipe', False)
|
||||
|
||||
#TRANSPORT = HidTransport
|
||||
#TRANSPORT_ARGS = ('0x10c4:0xea80:000868D3', False)
|
||||
|
||||
#TRANSPORT = SocketTransportClient
|
||||
#TRANSPORT_ARGS = ('trezor.dyn:3000', False)
|
||||
|
||||
#DEBUG_TRANSPORT = PipeTransport
|
||||
#DEBUG_TRANSPORT_ARGS = ('../../bitkey-python/pipe.debug', False)
|
||||
DEBUG_TRANSPORT = SocketTransportClient
|
||||
DEBUG_TRANSPORT_ARGS = ('trezor.dyn:2000', False)
|
||||
DEBUG_TRANSPORT = PipeTransport
|
||||
DEBUG_TRANSPORT_ARGS = ('../../bitkey-python/bitkey_debug.pipe', False)
|
||||
|
||||
#DEBUG_TRANSPORT = SocketTransportClient
|
||||
#DEBUG_TRANSPORT_ARGS = ('trezor.dyn:2000', False)
|
||||
|
@ -5,7 +5,8 @@ import bitkeylib.bitkey_pb2 as proto
|
||||
|
||||
class TestAddresses(common.BitkeyTest):
|
||||
def test_electrum_address(self):
|
||||
self.bitkey.load_device(seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
self.bitkey.load_device(algo=proto.ELECTRUM,
|
||||
seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
otp=False, pin='', spv=False)
|
||||
|
||||
self.bitkey.algo = proto.ELECTRUM
|
||||
@ -15,7 +16,8 @@ class TestAddresses(common.BitkeyTest):
|
||||
self.assertEqual(self.bitkey.get_address([9, 0]), "1C9DHmWBpvGcFKXEiWWC3EK3EY5Bj79nze")
|
||||
|
||||
def test_electrum_change_address(self):
|
||||
self.bitkey.load_device(seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
self.bitkey.load_device(algo=proto.ELECTRUM,
|
||||
seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
otp=False, pin='', spv=False)
|
||||
|
||||
self.bitkey.algo = proto.ELECTRUM
|
||||
|
@ -2,6 +2,7 @@ import unittest
|
||||
import common
|
||||
|
||||
from bitkeylib.client import CallException, PinException, OtpException
|
||||
from bitkeylib import proto
|
||||
|
||||
class TestProtectCall(common.BitkeyTest):
|
||||
def _some_protected_call(self):
|
||||
@ -11,34 +12,38 @@ class TestProtectCall(common.BitkeyTest):
|
||||
self.assertEqual(len(entropy), entropy_len)
|
||||
|
||||
def test_no_protection(self):
|
||||
self.bitkey.load_device(seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
self.bitkey.load_device(algo=proto.ELECTRUM,
|
||||
seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
otp=False, pin='', spv=False)
|
||||
|
||||
self.assertEqual(self.bitkey.features.otp, False)
|
||||
self.assertEqual(self.bitkey.features.has_otp, False)
|
||||
self.assertEqual(self.bitkey.features.pin, False)
|
||||
self._some_protected_call()
|
||||
|
||||
def test_otp_only(self):
|
||||
self.bitkey.load_device(seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
self.bitkey.load_device(algo=proto.ELECTRUM,
|
||||
seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
otp=True, pin='', spv=False)
|
||||
|
||||
self.assertEqual(self.bitkey.features.otp, True)
|
||||
self.assertEqual(self.bitkey.features.has_otp, True)
|
||||
self.assertEqual(self.bitkey.features.pin, False)
|
||||
self._some_protected_call()
|
||||
|
||||
def test_pin_only(self):
|
||||
self.bitkey.load_device(seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
self.bitkey.load_device(algo=proto.ELECTRUM,
|
||||
seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
otp=False, pin='2345', spv=False)
|
||||
|
||||
self.assertEqual(self.bitkey.features.otp, False)
|
||||
self.assertEqual(self.bitkey.features.has_otp, False)
|
||||
self.assertEqual(self.bitkey.features.pin, True)
|
||||
self._some_protected_call()
|
||||
|
||||
def test_both(self):
|
||||
self.bitkey.load_device(seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
self.bitkey.load_device(algo=proto.ELECTRUM,
|
||||
seed='beyond neighbor scratch swirl embarrass doll cause also stick softly physical nice',
|
||||
otp=True, pin='3456', spv=False)
|
||||
|
||||
self.assertEqual(self.bitkey.features.otp, True)
|
||||
self.assertEqual(self.bitkey.features.has_otp, True)
|
||||
self.assertEqual(self.bitkey.features.pin, True)
|
||||
self._some_protected_call()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user