diff --git a/tests/common.py b/tests/common.py index 6d13562d78..d48e38f24e 100644 --- a/tests/common.py +++ b/tests/common.py @@ -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() \ No newline at end of file + self.transport.close() diff --git a/tests/config.py b/tests/config.py index 2175ea8a12..9113cb5107 100644 --- a/tests/config.py +++ b/tests/config.py @@ -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) diff --git a/tests/test_addresses.py b/tests/test_addresses.py index b56f25b761..8a0113a9ad 100644 --- a/tests/test_addresses.py +++ b/tests/test_addresses.py @@ -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 diff --git a/tests/test_protect_call.py b/tests/test_protect_call.py index dac476de35..1efc0f9ab0 100644 --- a/tests/test_protect_call.py +++ b/tests/test_protect_call.py @@ -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()