From f17f7d0569755c455972805b5850a2578455c435 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 9 Jun 2014 15:33:54 +0200 Subject: [PATCH] don't use simplesigntx in tests where signtx can be used --- tests/test_msg_estimatetxsize.py | 2 +- tests/test_protection_levels.py | 7 ++----- tests/test_secexp.py | 10 ---------- tests/test_zerosig.py | 12 +++++------- 4 files changed, 8 insertions(+), 23 deletions(-) delete mode 100644 tests/test_secexp.py diff --git a/tests/test_msg_estimatetxsize.py b/tests/test_msg_estimatetxsize.py index 85283e8..5579679 100644 --- a/tests/test_msg_estimatetxsize.py +++ b/tests/test_msg_estimatetxsize.py @@ -25,7 +25,7 @@ class TestMsgEstimatetxsize(common.TrezorTest): est_size = self.client.estimate_tx_size('Bitcoin', [inp1, ], [out1, ]) self.assertEqual(est_size, 194) - tx = self.client.simple_sign_tx('Bitcoin', [inp1, ], [out1, ]) + (_, tx) = self.client.sign_tx('Bitcoin', [inp1, ], [out1, ]) real_size = len(tx) self.assertGreaterEqual(est_size, real_size) diff --git a/tests/test_protection_levels.py b/tests/test_protection_levels.py index e929488..7a52eda 100644 --- a/tests/test_protection_levels.py +++ b/tests/test_protection_levels.py @@ -6,8 +6,6 @@ from trezorlib import messages_pb2 as proto from trezorlib import types_pb2 as proto_types class TestProtectionLevels(common.TrezorTest): - # Tests protection levels of all messages as defined here: - # https://github.com/trezor/documentation/wiki/Protection-Levels def test_initialize(self): with self.client: @@ -130,9 +128,7 @@ class TestProtectionLevels(common.TrezorTest): self.client.set_expected_responses([proto.TxSize()]) self.client.estimate_tx_size('Bitcoin', [], []) - #def test_signtx(self): - # pass - + """ def test_simplesigntx(self): self.setup_mnemonic_pin_passphrase() @@ -153,6 +149,7 @@ class TestProtectionLevels(common.TrezorTest): proto.ButtonRequest(code=proto_types.ButtonRequest_SignTx), proto.TxRequest(request_type=proto_types.TXFINISHED)]) self.client.simple_sign_tx('Bitcoin', [inp1, ], [out1, ]) + """ def test_signtx(self): self.setup_mnemonic_pin_passphrase() diff --git a/tests/test_secexp.py b/tests/test_secexp.py deleted file mode 100644 index 1fb8dc9..0000000 --- a/tests/test_secexp.py +++ /dev/null @@ -1,10 +0,0 @@ -''' -TODO: Test private key generation. -Requires changes in DebugLink protocol - -address N -> secexp -1KqYyzL53R8oA1LdYvyv7m6JUryFfGJDpa 0 -> 58076025150540604300740730208658111746901313722419801903949973414685471840010 -13MzKU6YjjdyiW3dZJDa5VU4AWGczQsdYD 2 -> 24964362473980156971921866787933161040275203024491680251157021262214416818504 -1FQVPnjrbkPWeA8poUoEnX9U3n9DyhAVtv 3 -> 12500609616964965377900270839876716803428136543899720278159495092510064965376 -1C9DHmWBpvGcFKXEiWWC3EK3EY5Bj79nze 9 -> 67160564554915396199427939496499570939355460294705808200742756759419289432145 -''' \ No newline at end of file diff --git a/tests/test_zerosig.py b/tests/test_zerosig.py index 937d7ba..d2fc485 100644 --- a/tests/test_zerosig.py +++ b/tests/test_zerosig.py @@ -20,7 +20,7 @@ class TestZeroSig(common.TrezorTest): prev_index=0, ) - msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1, ], []) + msg = self.client._prepare_sign_tx('Bitcoin', [inp1, ], []) for n in range(3500, 200000): out1 = proto_types.TxOutputType(address_n=[n], @@ -55,9 +55,8 @@ class TestZeroSig(common.TrezorTest): script_type=proto_types.PAYTOADDRESS, ) - msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1], [out1]) - tx = self.client.call(msg) - siglen = ord(tx.serialized.serialized_tx[44]) + (signatures, serialized_tx) = self.client.sign_tx('Bitcoin', [inp1, ], [out1, ]) + siglen = ord(serialized_tx[44]) # Trezor must strip leading zero from signature self.assertEqual(siglen, 67) @@ -77,9 +76,8 @@ class TestZeroSig(common.TrezorTest): script_type=proto_types.PAYTOADDRESS, ) - msg = self.client._prepare_simple_sign_tx('Bitcoin', [inp1], [out1]) - tx = self.client.call(msg) - siglen = ord(tx.serialized.serialized_tx[44]) + (signatures, serialized_tx) = self.client.sign_tx('Bitcoin', [inp1, ], [out1, ]) + siglen = ord(serialized_tx[44]) # Trezor must strip leading zero from signature self.assertEqual(siglen, 66)