From 21b3b0ab91af332f1f084104f2002e072493fbc0 Mon Sep 17 00:00:00 2001 From: slush0 Date: Thu, 13 Feb 2014 16:47:28 +0100 Subject: [PATCH] Tests reworked to new TrezorClient API, all tests passes. --- tests/common.py | 11 +++++----- tests/test.py | 2 +- tests/test_debuglink.py | 6 +++--- tests/test_protect_call.py | 42 +++++++++++++++++--------------------- tests/test_signtx.py | 33 +++++++++++++++++++----------- 5 files changed, 49 insertions(+), 45 deletions(-) diff --git a/tests/common.py b/tests/common.py index 466ac651c..5493864e8 100644 --- a/tests/common.py +++ b/tests/common.py @@ -1,23 +1,22 @@ import unittest import config -from trezorlib.client import TrezorClient -from trezorlib.debuglink import DebugLink +from trezorlib.client import TrezorDebugClient +from trezorlib.api_blockchain import BlockchainApi 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 = TrezorClient(self.transport, DebugLink(self.debug_transport), debug=True) - # self.client = TrezorClient(self.transport, debug=False) + self.client = TrezorDebugClient(self.transport) + self.client.set_debuglink(self.debug_transport) + self.client.set_tx_func(BlockchainApi().get_tx) self.mnemonic1 = 'alcohol woman abuse must during monitor noble actual mixed trade anger aisle' self.mnemonic2 = 'owner little vague addict embark decide pink prosper true fork panda embody mixture exchange choose canoe electric jewel' self.pin1 = '1234' self.pin2 = '43211' - self.client.setup_debuglink(button=True, pin_correct=True) - self.client.wipe_device() self.client.load_device_by_mnemonic( mnemonic=self.mnemonic1, diff --git a/tests/test.py b/tests/test.py index 0b1a688a8..788870500 100755 --- a/tests/test.py +++ b/tests/test.py @@ -24,7 +24,7 @@ TODO: * VerifyMessage workflow * otestovat session handling (tento test bude zrejme failovat na RPi) - +* Failure_NotInitialized * Features reflects all variations of LoadDevice * Maxfee settings * Client requires OTP diff --git a/tests/test_debuglink.py b/tests/test_debuglink.py index df090ed6c..b114885bf 100644 --- a/tests/test_debuglink.py +++ b/tests/test_debuglink.py @@ -10,15 +10,15 @@ from trezorlib.client import PinException class TestDebugLink(common.TrezorTest): def test_layout(self): - layout = self.client.debuglink.read_layout() + layout = self.client.debug.read_layout() self.assertEqual(len(layout), 1024) def test_mnemonic(self): - mnemonic = self.client.debuglink.read_mnemonic() + mnemonic = self.client.debug.read_mnemonic() self.assertEqual(mnemonic, self.mnemonic1) def test_node(self): - node = self.client.debuglink.read_node() + node = self.client.debug.read_node() self.assertIsNotNone(node) if __name__ == '__main__': diff --git a/tests/test_protect_call.py b/tests/test_protect_call.py index 8575fdaba..1a2324b61 100644 --- a/tests/test_protect_call.py +++ b/tests/test_protect_call.py @@ -9,20 +9,14 @@ from trezorlib.client import PinException # FIXME TODO Add passphrase tests class TestProtectCall(common.TrezorTest): - def _some_protected_call(self, expected_buttonrequests): + def _some_protected_call(self, button, pin, passphrase): # This method perform any call which have protection in the device - - res = self.client.ping('random data', pin_protection=True, passphrase_protection=True) + res = self.client.ping('random data', + button_protection=button, + pin_protection=pin, + passphrase_protection=passphrase) self.assertEqual(res, 'random data') - msg = proto.Ping(message='random data', - button_protection=True, - pin_protection=True, - passphrase_protection=True) - - return self.client.call(msg, expected=proto.Success, - expected_buttonrequests=expected_buttonrequests).message - def test_no_protection(self): self.client.wipe_device() self.client.load_device_by_mnemonic( @@ -33,28 +27,30 @@ class TestProtectCall(common.TrezorTest): language='english', ) - self.assertEqual(self.client.debuglink.read_pin()[0], '') - self._some_protected_call([]) + self.assertEqual(self.client.debug.read_pin()[0], '') + self.client.set_expected_buttonrequests([]) + self._some_protected_call(False, True, True) - ''' def test_pin(self): self.client.wipe_device() self.client.load_device_by_mnemonic(mnemonic=self.mnemonic1, pin=self.pin2, - passphrase_protection=False, + passphrase_protection=True, label='test', language='english') - self.assertEqual(self.client.debuglink.read_pin()[0], self.pin2) - self._some_protected_call() - + self.assertEqual(self.client.debug.read_pin()[0], self.pin2) + self.client.setup_debuglink(button=True, pin_correct=True) + self.client.set_expected_buttonrequests([types.ButtonRequest_Other]) + self._some_protected_call(True, True, False) + def test_incorrect_pin(self): self.client.setup_debuglink(button=True, pin_correct=False) - self.assertRaises(PinException, self._some_protected_call) + self.assertRaises(PinException, self._some_protected_call, False, True, False) def test_cancelled_pin(self): - self.client.setup_debuglink(button=True, pin_correct=-1) # PIN cancel - self.assertRaises(PinException, self._some_protected_call) + self.client.setup_debuglink(button=True, pin_correct=False) # PIN cancel + self.assertRaises(PinException, self._some_protected_call, False, True, False) def test_exponential_backoff_with_reboot(self): self.client.setup_debuglink(button=True, pin_correct=False) @@ -69,9 +65,9 @@ class TestProtectCall(common.TrezorTest): for attempt in range(1, 4): start = time.time() - self.assertRaises(PinException, self._some_protected_call) + self.assertRaises(PinException, self._some_protected_call, False, True, False) test_backoff(attempt, start) - ''' + ''' # Unplug Trezor now self.client.debuglink.stop() diff --git a/tests/test_signtx.py b/tests/test_signtx.py index 3ee0ee939..fc8ec5ca8 100644 --- a/tests/test_signtx.py +++ b/tests/test_signtx.py @@ -55,7 +55,8 @@ class TestSignTx(common.TrezorTest): msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1, ], [out1, ]) expected_btn = [proto_types.ButtonRequest_ConfirmOutput] - tx = self.client.call(msg, expected_buttonrequests=expected_btn) + self.client.set_expected_buttonrequests(expected_btn) + tx = self.client.call(msg) # Accepted by network: tx fd79435246dee76b2f159d2db08032d666c95adc544de64c8c49f474df4a7fee self.assertEqual(binascii.hexlify(tx.serialized_tx), '010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b4830450221009a0b7be0d4ed3146ee262b42202841834698bb3ee39c24e7437df208b8b7077102202b79ab1e7736219387dffe8d615bbdba87e11477104b867ef47afed1a5ede7810121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0160cc0500000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac00000000') @@ -79,10 +80,11 @@ class TestSignTx(common.TrezorTest): script_type=proto_types.PAYTOADDRESS, ) - self.client.blockchain = FakeTestnetBlockchain() + self.client.set_tx_func(FakeTestnetBlockchain().get_tx) msg = self.client._prepare_simple_sign_tx('Testnet', [inp1, ], [out1, out2]) expected_btn = [proto_types.ButtonRequest_ConfirmOutput] * 2 - tx = self.client.call(msg, expected_buttonrequests=expected_btn) + self.client.set_expected_buttonrequests(expected_btn) + tx = self.client.call(msg) self.assertEqual(binascii.hexlify(tx.serialized_tx), '0100000001549d2977998f899a63c0a9da30dedb2841e33fef561097b05822eccbc7f3906f010000006b4830450221009c2d30385519fdb13dce13d5ac038be07d7b2dad0b0f7b2c1c339d7255bcf553022056a2f5bceab3cd0ffed4d388387e631f419d67ff9ce7798e3d7dfe6a6d6ec4bd0121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0280ce341d000000001976a9140223b1a09138753c9cb0baf95a0a62c82711567a88ac0065cd1d000000001976a9142db345c36563122e2fd0f5485fb7ea9bbf7cb5a288ac00000000') @@ -105,12 +107,13 @@ class TestSignTx(common.TrezorTest): script_type=proto_types.PAYTOADDRESS, ) - self.client.blockchain = FakeTestnetBlockchain() + self.client.set_tx_func(FakeTestnetBlockchain().get_tx) msg = self.client._prepare_simple_sign_tx('Testnet', [inp1, ], [out1, out2]) expected_btn = [proto_types.ButtonRequest_ConfirmOutput, proto_types.ButtonRequest_ConfirmOutput, proto_types.ButtonRequest_FeeOverThreshold] - tx = self.client.call(msg, expected_buttonrequests=expected_btn) + self.client.set_expected_buttonrequests(expected_btn) + tx = self.client.call(msg) self.assertEqual(binascii.hexlify(tx.serialized_tx), '0100000001549d2977998f899a63c0a9da30dedb2841e33fef561097b05822eccbc7f3906f010000006b483045022100d74e9fa5c7ff5966d52bce8d1d772c1e3ef1376395fb85a0bbf910e723bd606d02204cb8df6debd7c4c076632011bb1e180495bcf3630d2471c354bed56c2e45a2180121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0200389c1c000000001976a9140223b1a09138753c9cb0baf95a0a62c82711567a88ac0065cd1d000000001976a9142db345c36563122e2fd0f5485fb7ea9bbf7cb5a288ac00000000') @@ -136,7 +139,8 @@ class TestSignTx(common.TrezorTest): msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1, ], [out1, out2]) expected_btn = [proto_types.ButtonRequest_ConfirmOutput] * 2 - tx = self.client.call(msg, expected_buttonrequests=expected_btn) + self.client.set_expected_buttonrequests(expected_btn) + tx = self.client.call(msg) self.assertEqual(binascii.hexlify(tx.serialized_tx), '010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b483045022100c1400d8485d3bdcae7413e123148f35ece84806fc387ab88c66b469df89aef1702201d481d04216b319dc549ffe2333143629ba18828a4e2d1783ab719a6aa263eb70121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff02e0930400000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac80380100000000001976a9140223b1a09138753c9cb0baf95a0a62c82711567a88ac00000000') @@ -167,7 +171,8 @@ class TestSignTx(common.TrezorTest): msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1, ], [out1, out2, out3]) expected_btn = [proto_types.ButtonRequest_ConfirmOutput] * 3 - tx = self.client.call(msg, expected_buttonrequests=expected_btn) + self.client.set_expected_buttonrequests(expected_btn) + tx = self.client.call(msg) self.assertEqual(binascii.hexlify(tx.serialized_tx), '010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006b483045022100e695e2c530c7c0fc32e6b79b7cff56a7f70a8c9da787534f46b4204070f914fc02207b0879a81408a11e23b11d4c7965c62b5fc6d5c2d92340f5ee2da7b40e99314a0121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0300650400000000001976a914de9b2a8da088824e8fe51debea566617d851537888ace02e0000000000001976a9141fe1d337fb81afca42818051e12fd18245d1b17288ac80380100000000001976a9140223b1a09138753c9cb0baf95a0a62c82711567a88ac00000000') @@ -201,7 +206,8 @@ class TestSignTx(common.TrezorTest): msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1, inp2], [out1, out2]) expected_btn = [proto_types.ButtonRequest_ConfirmOutput] * 2 - tx = self.client.call(msg, expected_buttonrequests=expected_btn) + self.client.set_expected_buttonrequests(expected_btn) + tx = self.client.call(msg) # Accepted by network: tx c63e24ed820c5851b60c54613fbc4bcb37df6cd49b4c96143e99580a472f79fb self.assertEqual(binascii.hexlify(tx.serialized_tx), '01000000021c032e5715d1da8115a2fe4f57699e15742fe113b0d2d1ca3b594649d322bec6010000006b483045022100f773c403b2f85a5c1d6c9c4ad69c43de66930fff4b1bc818eb257af98305546a0220443bde4be439f276a6ce793664b463580e210ec6c9255d68354449ac0443c76501210338d78612e990f2eea0c426b5e48a8db70b9d7ed66282b3b26511e0b1c75515a6ffffffff6ea42cd8d9c8e5441c4c5f85bfe50311078730d2881494f11f4d2257777a4958010000006b48304502210090cff1c1911e771605358a8cddd5ae94c7b60cc96e50275908d9bf9d6367c79f02202bfa72e10260a146abd59d0526e1335bacfbb2b4401780e9e3a7441b0480c8da0121038caebd6f753bbbd2bb1f3346a43cd32140648583673a31d62f2dfb56ad0ab9e3ffffffff02a0860100000000001976a9142f4490d5263906e4887ca2996b9e207af3e7824088aca0860100000000001976a914812c13d97f9159e54e326b481b8f88a73df8507a88ac00000000') @@ -237,7 +243,8 @@ class TestSignTx(common.TrezorTest): msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1, inp2], outputs) expected_btn = [proto_types.ButtonRequest_ConfirmOutput] * 255 - tx = self.client.call(msg, expected_buttonrequests=expected_btn) + self.client.set_expected_buttonrequests(expected_btn) + tx = self.client.call(msg) self.assertEqual(binascii.hexlify(tx.serialized_tx), '0100000002fb792f470a58993e14964c9bd46cdf37cb4bbc3f61540cb651580c82ed243ec6010000006b483045022100969da46f94a81f34f3717b014e0c3e1826eda1b0022ec2f9ce39f3d750ab9235022026da269770993211a1503413566a339bbb4389a482fffcf8e1f76713fc3b94f5012103477b9f0f34ae85434ce795f0c5e1e90c9420e5b5fad084d7cce9a487b94a7902ffffffffe56582d2119100cb1d3da8232291e053f71e25fb669c87b32a667749959ea239010000006a473044022052e1419bb237b9db400ab5e3df16db6355619d545fde9030924a360763ae9ad40220704beab04d72ecaeb42eca7d98faca7a0941e65f2e1341f183be2b83e6b09e1c012103477b9f0f34ae85434ce795f0c5e1e90c9420e5b5fad084d7cce9a487b94a7902fffffffffdff00d8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088acd8270000000000001976a914f0a2b64e56ee2ff57126232f84af6e3a41d4055088ac00000000') ''' @@ -260,7 +267,8 @@ class TestSignTx(common.TrezorTest): msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1, ], [out1, ]) expected_btn = [proto_types.ButtonRequest_ConfirmOutput, proto_types.ButtonRequest_FeeOverThreshold] - tx = self.client.call(msg, expected_buttonrequests=expected_btn) + self.client.set_expected_buttonrequests(expected_btn) + tx = self.client.call(msg) self.assertEqual(binascii.hexlify(tx.serialized_tx), '010000000182488650ef25a58fef6788bd71b8212038d7f2bbe4750bc7bcb44701e85ef6d5000000006a4730440220361b8268718533055682f4532d30c553ce778f70b217457a9aa1956e457c5aac0220538ae285bb340484bb09a67635d29192a14e61d8a8385b8b090a92e3e97e1c010121023230848585885f63803a0a8aecdd6538792d5c539215c91698e315bf0253b43dffffffff0120300500000000001976a914de9b2a8da088824e8fe51debea566617d851537888ac00000000') @@ -281,8 +289,9 @@ class TestSignTx(common.TrezorTest): msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1, ], [out1, ]) expected_btn = [proto_types.ButtonRequest_ConfirmOutput] + self.client.set_expected_buttonrequests(expected_btn) try: - self.client.call(msg, expected_buttonrequests=expected_btn) + self.client.call(msg) except CallException as e: self.assertEqual(e.args[0], proto_types.Failure_NotEnoughFunds) else: @@ -305,7 +314,7 @@ class TestSignTx(common.TrezorTest): self.assertEqual(est_size, 194) tx = self.client.simple_sign_tx('Bitcoin', [inp1, ], [out1, ]) - real_size = len(tx.serialized_tx) + real_size = len(tx) self.assertGreaterEqual(est_size, real_size)