From b3569a53e6cb48e0f3874eaa32cef328d0d24602 Mon Sep 17 00:00:00 2001 From: matejcik Date: Tue, 3 Mar 2020 17:29:02 +0100 Subject: [PATCH] tests: update tx_cache usages --- tests/device_tests/test_msg_signtx.py | 10 +++++----- tests/device_tests/test_msg_signtx_bcash.py | 4 ++-- tests/device_tests/test_msg_signtx_bgold.py | 4 ++-- tests/device_tests/test_msg_signtx_capricoin.py | 4 ++-- tests/device_tests/test_msg_signtx_dash.py | 4 ++-- tests/device_tests/test_msg_signtx_decred.py | 4 ++-- tests/device_tests/test_msg_signtx_grs.py | 4 ++-- tests/device_tests/test_msg_signtx_komodo.py | 5 ++--- tests/device_tests/test_msg_signtx_peercoin.py | 4 ++-- tests/device_tests/test_msg_signtx_segwit.py | 4 ++-- tests/device_tests/test_msg_signtx_segwit_native.py | 4 ++-- tests/device_tests/test_msg_signtx_zcash.py | 4 ++-- tests/device_tests/test_multisig.py | 4 ++-- tests/device_tests/test_multisig_change.py | 4 ++-- tests/device_tests/test_op_return.py | 4 ++-- tests/device_tests/test_protection_levels.py | 6 ++---- tests/device_tests/test_zerosig.py | 6 +++--- 17 files changed, 38 insertions(+), 41 deletions(-) diff --git a/tests/device_tests/test_msg_signtx.py b/tests/device_tests/test_msg_signtx.py index 0c97caec4f..a2e958b961 100644 --- a/tests/device_tests/test_msg_signtx.py +++ b/tests/device_tests/test_msg_signtx.py @@ -20,7 +20,7 @@ from trezorlib import btc, messages as proto from trezorlib.tools import H_, CallException, btc_hash, parse_path from ..common import MNEMONIC12 -from ..tx_cache import tx_cache +from ..tx_cache import TxCache TXHASH_157041 = bytes.fromhex( "1570416eb4302cf52979afd5e6909e37d8fdd874301f7cc87e547e509cb1caa6" @@ -78,7 +78,7 @@ def check_sign_tx( __tracebackhide__ = True expected_responses = [] - txes = tx_cache(coin_name) + txes = TxCache(coin_name) t = proto.RequestType b = proto.ButtonRequestType @@ -611,7 +611,7 @@ class TestMsgSigntx: "Bitcoin", [inp1, inp2], [out1, out2], - prev_txes=tx_cache("Bitcoin"), + prev_txes=TxCache("Bitcoin"), ) assert exc.value.args[0] in ( proto.FailureType.ProcessError, @@ -663,7 +663,7 @@ class TestMsgSigntx: with pytest.raises(CallException) as exc: btc.sign_tx( - client, "Testnet", [inp1], [out1, out2], prev_txes=tx_cache("Testnet") + client, "Testnet", [inp1], [out1, out2], prev_txes=TxCache("Testnet") ) assert exc.value.args[0] in ( @@ -768,7 +768,7 @@ class TestMsgSigntx: "Testnet", [inp1], [out1, out2], - prev_txes=tx_cache("Testnet"), + prev_txes=TxCache("Testnet"), ) assert exc.value.args[0] == proto.FailureType.ProcessError diff --git a/tests/device_tests/test_msg_signtx_bcash.py b/tests/device_tests/test_msg_signtx_bcash.py index 4ff15d3da6..4d4d74a1e6 100644 --- a/tests/device_tests/test_msg_signtx_bcash.py +++ b/tests/device_tests/test_msg_signtx_bcash.py @@ -19,9 +19,9 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import H_, CallException, parse_path -from ..tx_cache import tx_cache +from ..tx_cache import TxCache -TX_API = tx_cache("Bcash") +TX_API = TxCache("Bcash") @pytest.mark.altcoin diff --git a/tests/device_tests/test_msg_signtx_bgold.py b/tests/device_tests/test_msg_signtx_bgold.py index 6623283394..3d4e427cf9 100644 --- a/tests/device_tests/test_msg_signtx_bgold.py +++ b/tests/device_tests/test_msg_signtx_bgold.py @@ -19,9 +19,9 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import H_, CallException, parse_path -from ..tx_cache import tx_cache +from ..tx_cache import TxCache -TX_API = tx_cache("Bgold") +TX_API = TxCache("Bgold") # All data taken from T1 diff --git a/tests/device_tests/test_msg_signtx_capricoin.py b/tests/device_tests/test_msg_signtx_capricoin.py index 20bd4f7d16..add8011029 100644 --- a/tests/device_tests/test_msg_signtx_capricoin.py +++ b/tests/device_tests/test_msg_signtx_capricoin.py @@ -19,7 +19,7 @@ import pytest from trezorlib import btc, messages from trezorlib.tools import parse_path -from ..tx_cache import tx_cache +from ..tx_cache import TxCache TXHASH_3bf506 = bytes.fromhex( "3bf506c81ce84eda891679ddc797d162c17c60b15d6c0ac23be5e31369e7235f" @@ -61,7 +61,7 @@ def test_timestamp_included(client): [inp1, inp2], [out1], details=details, - prev_txes=tx_cache("Capricoin"), + prev_txes=TxCache("Capricoin"), ) # Accepted by network https://insight.capricoin.org/tx/1bf227e6e24fe1f8ac98849fe06a2c5b77762e906fcf7e82787675f7f3a10bb8 diff --git a/tests/device_tests/test_msg_signtx_dash.py b/tests/device_tests/test_msg_signtx_dash.py index f87981281b..3714d2ae9d 100644 --- a/tests/device_tests/test_msg_signtx_dash.py +++ b/tests/device_tests/test_msg_signtx_dash.py @@ -19,9 +19,9 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from ..tx_cache import tx_cache +from ..tx_cache import TxCache -TX_API = tx_cache("Dash") +TX_API = TxCache("Dash") @pytest.mark.altcoin diff --git a/tests/device_tests/test_msg_signtx_decred.py b/tests/device_tests/test_msg_signtx_decred.py index 4ef5bb27be..4bf28a88d7 100644 --- a/tests/device_tests/test_msg_signtx_decred.py +++ b/tests/device_tests/test_msg_signtx_decred.py @@ -19,9 +19,9 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from ..tx_cache import tx_cache +from ..tx_cache import TxCache -TX_API = tx_cache("Decred Testnet") +TX_API = TxCache("Decred Testnet") TXHASH_e16248 = bytes.fromhex( diff --git a/tests/device_tests/test_msg_signtx_grs.py b/tests/device_tests/test_msg_signtx_grs.py index 73ee11d436..fd3676b84d 100644 --- a/tests/device_tests/test_msg_signtx_grs.py +++ b/tests/device_tests/test_msg_signtx_grs.py @@ -19,9 +19,9 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from ..tx_cache import tx_cache +from ..tx_cache import TxCache -TX_API = tx_cache("Groestlcoin") +TX_API = TxCache("Groestlcoin") @pytest.mark.altcoin diff --git a/tests/device_tests/test_msg_signtx_komodo.py b/tests/device_tests/test_msg_signtx_komodo.py index c7594ee739..1381ff2a23 100644 --- a/tests/device_tests/test_msg_signtx_komodo.py +++ b/tests/device_tests/test_msg_signtx_komodo.py @@ -19,10 +19,9 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from ..tx_cache import tx_cache +from ..tx_cache import TxCache -# KMD has no usable backends, use cached TX only -TX_API = tx_cache("Komodo", allow_fetch=False) +TX_API = TxCache("Komodo") TXHASH_2807c = bytes.fromhex( "2807c5b126ec8e2b078cab0f12e4c8b4ce1d7724905f8ebef8dca26b0c8e0f1d" diff --git a/tests/device_tests/test_msg_signtx_peercoin.py b/tests/device_tests/test_msg_signtx_peercoin.py index 1d258a3563..16b512b715 100644 --- a/tests/device_tests/test_msg_signtx_peercoin.py +++ b/tests/device_tests/test_msg_signtx_peercoin.py @@ -19,7 +19,7 @@ import pytest from trezorlib import btc, messages from trezorlib.tools import parse_path -from ..tx_cache import tx_cache +from ..tx_cache import TxCache TXHASH_41b29a = bytes.fromhex( "41b29ad615d8eea40a4654a052d18bb10cd08f203c351f4d241f88b031357d3d" @@ -50,7 +50,7 @@ def test_timestamp_included(client): [inp1], [out1], details=details, - prev_txes=tx_cache("Peercoin", allow_fetch=False), + prev_txes=TxCache("Peercoin"), ) # Accepted by network https://explorer.peercoin.net/api/getrawtransaction?txid=f7e3624c143b6a170cc44f9337d0fa8ea8564a211de9c077c6889d8c78f80909&decrypt=1 diff --git a/tests/device_tests/test_msg_signtx_segwit.py b/tests/device_tests/test_msg_signtx_segwit.py index ec83d9ff5e..fba9b77b7d 100644 --- a/tests/device_tests/test_msg_signtx_segwit.py +++ b/tests/device_tests/test_msg_signtx_segwit.py @@ -19,9 +19,9 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import H_, CallException, parse_path -from ..tx_cache import tx_cache +from ..tx_cache import TxCache -TX_API = tx_cache("Testnet") +TX_API = TxCache("Testnet") class TestMsgSigntxSegwit: diff --git a/tests/device_tests/test_msg_signtx_segwit_native.py b/tests/device_tests/test_msg_signtx_segwit_native.py index 51c66639d3..3a18c994ea 100644 --- a/tests/device_tests/test_msg_signtx_segwit_native.py +++ b/tests/device_tests/test_msg_signtx_segwit_native.py @@ -20,9 +20,9 @@ from trezorlib import btc, messages as proto from trezorlib.ckd_public import deserialize from trezorlib.tools import H_, parse_path -from ..tx_cache import tx_cache +from ..tx_cache import TxCache -TX_API = tx_cache("Testnet") +TX_API = TxCache("Testnet") class TestMsgSigntxSegwitNative: diff --git a/tests/device_tests/test_msg_signtx_zcash.py b/tests/device_tests/test_msg_signtx_zcash.py index e063c3e938..6c5e374df5 100644 --- a/tests/device_tests/test_msg_signtx_zcash.py +++ b/tests/device_tests/test_msg_signtx_zcash.py @@ -19,9 +19,9 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from ..tx_cache import tx_cache +from ..tx_cache import TxCache -TX_API = tx_cache("Zcash Testnet") +TX_API = TxCache("Zcash Testnet") TXHASH_aaf51e = bytes.fromhex( "aaf51e4606c264e47e5c42c958fe4cf1539c5172684721e38e69f4ef634d75dc" diff --git a/tests/device_tests/test_multisig.py b/tests/device_tests/test_multisig.py index daab63254c..f43b83d1df 100644 --- a/tests/device_tests/test_multisig.py +++ b/tests/device_tests/test_multisig.py @@ -20,9 +20,9 @@ from trezorlib import btc, ckd_public as bip32, messages as proto from trezorlib.tools import CallException, parse_path from ..common import MNEMONIC12 -from ..tx_cache import tx_cache +from ..tx_cache import TxCache -TX_API = tx_cache("Bitcoin") +TX_API = TxCache("Bitcoin") TXHASH_c6091a = bytes.fromhex( "c6091adf4c0c23982a35899a6e58ae11e703eacd7954f588ed4b9cdefc4dba52" diff --git a/tests/device_tests/test_multisig_change.py b/tests/device_tests/test_multisig_change.py index fe566fc89e..e57c16f0b6 100644 --- a/tests/device_tests/test_multisig_change.py +++ b/tests/device_tests/test_multisig_change.py @@ -20,9 +20,9 @@ from trezorlib import btc, ckd_public as bip32, messages as proto from trezorlib.tools import H_, parse_path from ..common import MNEMONIC12 -from ..tx_cache import tx_cache +from ..tx_cache import TxCache -TX_API = tx_cache("Testnet") +TX_API = TxCache("Testnet") class TestMultisigChange: diff --git a/tests/device_tests/test_op_return.py b/tests/device_tests/test_op_return.py index 4062e73251..378afa7d04 100644 --- a/tests/device_tests/test_op_return.py +++ b/tests/device_tests/test_op_return.py @@ -19,9 +19,9 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import CallException, parse_path -from ..tx_cache import tx_cache +from ..tx_cache import TxCache -TX_API = tx_cache("Bitcoin") +TX_API = TxCache("Bitcoin") TXHASH_d5f65e = bytes.fromhex( "d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882" diff --git a/tests/device_tests/test_protection_levels.py b/tests/device_tests/test_protection_levels.py index 9c2b14bab5..6b2a68099d 100644 --- a/tests/device_tests/test_protection_levels.py +++ b/tests/device_tests/test_protection_levels.py @@ -20,7 +20,7 @@ from trezorlib import btc, device, messages as proto, misc from trezorlib.exceptions import TrezorFailure from ..common import MNEMONIC12 -from ..tx_cache import tx_cache +from ..tx_cache import TxCache TXHASH_d5f65e = bytes.fromhex( "d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882" @@ -246,9 +246,7 @@ class TestProtectionLevels: proto.TxRequest(request_type=proto.RequestType.TXFINISHED), ] ) - btc.sign_tx( - client, "Bitcoin", [inp1], [out1], prev_txes=tx_cache("Bitcoin") - ) + btc.sign_tx(client, "Bitcoin", [inp1], [out1], prev_txes=TxCache("Bitcoin")) # def test_firmware_erase(self): # pass diff --git a/tests/device_tests/test_zerosig.py b/tests/device_tests/test_zerosig.py index dbf6e4a0df..24d8d40a84 100644 --- a/tests/device_tests/test_zerosig.py +++ b/tests/device_tests/test_zerosig.py @@ -19,7 +19,7 @@ import pytest from trezorlib import btc, messages as proto from ..common import MNEMONIC12 -from ..tx_cache import tx_cache +from ..tx_cache import TxCache TXHASH_d5f65e = bytes.fromhex( "d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882" @@ -46,7 +46,7 @@ class TestZerosig: ) _, serialized_tx = btc.sign_tx( - client, "Bitcoin", [inp1], [out1], prev_txes=tx_cache("Bitcoin") + client, "Bitcoin", [inp1], [out1], prev_txes=TxCache("Bitcoin") ) siglen = serialized_tx[44] @@ -70,7 +70,7 @@ class TestZerosig: ) _, serialized_tx = btc.sign_tx( - client, "Bitcoin", [inp1], [out1], prev_txes=tx_cache("Bitcoin") + client, "Bitcoin", [inp1], [out1], prev_txes=TxCache("Bitcoin") ) siglen = serialized_tx[44]