From 56f5f73550f1079b40f9f156ff8dd798b60589ee Mon Sep 17 00:00:00 2001 From: matejcik Date: Wed, 11 Sep 2019 14:29:39 +0200 Subject: [PATCH] tests: drop TrezorTest class --- tests/device_tests/test_basic.py | 4 +- tests/device_tests/test_bip32_speed.py | 4 +- tests/device_tests/test_cosi.py | 4 +- tests/device_tests/test_debuglink.py | 6 +- tests/device_tests/test_msg_applysettings.py | 3 +- tests/device_tests/test_msg_changepin.py | 31 ++++---- tests/device_tests/test_msg_cipherkeyvalue.py | 4 +- tests/device_tests/test_msg_clearsession.py | 4 +- .../test_msg_eos_get_public_key.py | 4 +- tests/device_tests/test_msg_eos_signtx.py | 4 +- .../test_msg_ethereum_getaddress.py | 4 +- .../test_msg_ethereum_getpublickey.py | 4 +- .../test_msg_ethereum_signmessage.py | 4 +- .../device_tests/test_msg_ethereum_signtx.py | 4 +- .../test_msg_ethereum_verifymessage.py | 4 +- tests/device_tests/test_msg_getaddress.py | 4 +- .../test_msg_getaddress_segwit.py | 4 +- .../test_msg_getaddress_segwit_native.py | 4 +- .../device_tests/test_msg_getaddress_show.py | 4 +- .../test_msg_getecdhsessionkey.py | 4 +- tests/device_tests/test_msg_getpublickey.py | 4 +- .../test_msg_getpublickey_curve.py | 4 +- .../device_tests/test_msg_lisk_getaddress.py | 4 +- .../test_msg_lisk_getpublickey.py | 4 +- .../device_tests/test_msg_lisk_signmessage.py | 4 +- tests/device_tests/test_msg_lisk_signtx.py | 4 +- .../test_msg_lisk_verifymessage.py | 4 +- tests/device_tests/test_msg_loaddevice.py | 4 +- .../device_tests/test_msg_loaddevice_xprv.py | 4 +- .../test_msg_monero_getaddress.py | 4 +- .../test_msg_monero_getwatchkey.py | 4 +- tests/device_tests/test_msg_nem_getaddress.py | 4 +- .../test_msg_nem_signtx_mosaics.py | 4 +- .../test_msg_nem_signtx_mosaics_t2.py | 4 +- .../test_msg_nem_signtx_multisig.py | 4 +- .../test_msg_nem_signtx_others.py | 4 +- .../test_msg_nem_signtx_transfers.py | 4 +- tests/device_tests/test_msg_ping.py | 4 +- tests/device_tests/test_msg_recoverydevice.py | 23 +++--- .../test_msg_recoverydevice_dryrun.py | 4 +- .../test_msg_recoverydevice_t2.py | 12 +-- tests/device_tests/test_msg_resetdevice.py | 8 +- .../test_msg_resetdevice_nobackup.py | 4 +- .../test_msg_resetdevice_skipbackup.py | 4 +- .../test_msg_ripple_get_address.py | 4 +- tests/device_tests/test_msg_ripple_sign_tx.py | 4 +- tests/device_tests/test_msg_signidentity.py | 4 +- tests/device_tests/test_msg_signmessage.py | 4 +- .../test_msg_signmessage_decred.py | 4 +- .../test_msg_signmessage_segwit.py | 4 +- .../test_msg_signmessage_segwit_native.py | 4 +- tests/device_tests/test_msg_signtx.py | 4 +- tests/device_tests/test_msg_signtx_bcash.py | 3 +- tests/device_tests/test_msg_signtx_bgold.py | 3 +- tests/device_tests/test_msg_signtx_dash.py | 3 +- tests/device_tests/test_msg_signtx_decred.py | 3 +- tests/device_tests/test_msg_signtx_grs.py | 3 +- tests/device_tests/test_msg_signtx_komodo.py | 3 +- tests/device_tests/test_msg_signtx_segwit.py | 3 +- .../test_msg_signtx_segwit_native.py | 3 +- tests/device_tests/test_msg_signtx_zcash.py | 3 +- .../test_msg_stellar_get_address.py | 4 +- .../test_msg_stellar_sign_transaction.py | 4 +- .../device_tests/test_msg_tezos_getaddress.py | 4 +- .../test_msg_tezos_getpublickey.py | 4 +- tests/device_tests/test_msg_tezos_sign_tx.py | 4 +- tests/device_tests/test_msg_verifymessage.py | 4 +- .../test_msg_verifymessage_segwit.py | 4 +- .../test_msg_verifymessage_segwit_native.py | 4 +- tests/device_tests/test_msg_wipedevice.py | 4 +- tests/device_tests/test_multisig.py | 4 +- tests/device_tests/test_multisig_change.py | 4 +- tests/device_tests/test_op_return.py | 3 +- tests/device_tests/test_protect_call.py | 76 +++++++++---------- tests/device_tests/test_protection_levels.py | 6 +- tests/device_tests/test_zerosig.py | 36 +-------- 76 files changed, 186 insertions(+), 273 deletions(-) diff --git a/tests/device_tests/test_basic.py b/tests/device_tests/test_basic.py index d4ec51632..6a503d143 100644 --- a/tests/device_tests/test_basic.py +++ b/tests/device_tests/test_basic.py @@ -16,10 +16,8 @@ from trezorlib import device, messages -from .common import TrezorTest - -class TestBasic(TrezorTest): +class TestBasic: def test_features(self, client): f0 = client.features f1 = client.call(messages.Initialize()) diff --git a/tests/device_tests/test_bip32_speed.py b/tests/device_tests/test_bip32_speed.py index 0ce6f1ba4..2b0972744 100644 --- a/tests/device_tests/test_bip32_speed.py +++ b/tests/device_tests/test_bip32_speed.py @@ -21,11 +21,9 @@ import pytest from trezorlib import btc from trezorlib.tools import H_ -from .common import TrezorTest - @pytest.mark.flaky(max_runs=5) -class TestBip32Speed(TrezorTest): +class TestBip32Speed: def test_public_ckd(self, client): btc.get_address(client, "Bitcoin", []) # to compute root node via BIP39 diff --git a/tests/device_tests/test_cosi.py b/tests/device_tests/test_cosi.py index 5f46fbc31..aadb33e9d 100644 --- a/tests/device_tests/test_cosi.py +++ b/tests/device_tests/test_cosi.py @@ -21,11 +21,9 @@ import pytest from trezorlib import cosi from trezorlib.tools import parse_path -from .common import TrezorTest - @pytest.mark.skip_t2 -class TestCosi(TrezorTest): +class TestCosi: def test_cosi_commit(self, client): digest = sha256(b"this is a message").digest() diff --git a/tests/device_tests/test_debuglink.py b/tests/device_tests/test_debuglink.py index 9e3a620d9..50f77f401 100644 --- a/tests/device_tests/test_debuglink.py +++ b/tests/device_tests/test_debuglink.py @@ -18,11 +18,11 @@ import pytest from trezorlib import debuglink, messages -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 @pytest.mark.skip_t2 -class TestDebuglink(TrezorTest): +class TestDebuglink: def test_layout(self, client): layout = client.debug.state().layout assert len(layout) == 1024 @@ -40,7 +40,7 @@ class TestDebuglink(TrezorTest): label="test", ) mnemonic = client.debug.state().mnemonic_secret - assert mnemonic == self.mnemonic12.encode() + assert mnemonic == MNEMONIC12.encode() @pytest.mark.setup_client(mnemonic=MNEMONIC12, pin="1234", passphrase=True) def test_pin(self, client): diff --git a/tests/device_tests/test_msg_applysettings.py b/tests/device_tests/test_msg_applysettings.py index 40e0fd343..1578eb824 100644 --- a/tests/device_tests/test_msg_applysettings.py +++ b/tests/device_tests/test_msg_applysettings.py @@ -20,7 +20,6 @@ import pytest from trezorlib import device, messages as proto -from .common import TrezorTest from .conftest import TREZOR_VERSION EXPECTED_RESPONSES_NOPIN = [proto.ButtonRequest(), proto.Success(), proto.Features()] @@ -33,7 +32,7 @@ else: @pytest.mark.setup_client(pin=True) -class TestMsgApplysettings(TrezorTest): +class TestMsgApplysettings: def test_apply_settings(self, client): assert client.features.label == "test" diff --git a/tests/device_tests/test_msg_changepin.py b/tests/device_tests/test_msg_changepin.py index 7a3c9964d..f9fdf4eab 100644 --- a/tests/device_tests/test_msg_changepin.py +++ b/tests/device_tests/test_msg_changepin.py @@ -18,11 +18,14 @@ import pytest from trezorlib import messages as proto -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 + +PIN4 = "1234" +PIN6 = "789456" @pytest.mark.skip_t2 -class TestMsgChangepin(TrezorTest): +class TestMsgChangepin: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_set_pin(self, client): features = client.call_raw(proto.Initialize()) @@ -42,12 +45,12 @@ class TestMsgChangepin(TrezorTest): # Send the PIN for first time assert isinstance(ret, proto.PinMatrixRequest) - pin_encoded = client.debug.encode_pin(self.pin6) + pin_encoded = client.debug.encode_pin(PIN6) ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) # Send the PIN for second time assert isinstance(ret, proto.PinMatrixRequest) - pin_encoded = client.debug.encode_pin(self.pin6) + pin_encoded = client.debug.encode_pin(PIN6) ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) # Now we're done @@ -58,7 +61,7 @@ class TestMsgChangepin(TrezorTest): assert features.pin_protection is True # Check that the PIN is correct - self.check_pin(client, self.pin6) + self.check_pin(client, PIN6) @pytest.mark.setup_client(mnemonic=MNEMONIC12, pin=True, passphrase=True) def test_change_pin(self, client): @@ -71,7 +74,7 @@ class TestMsgChangepin(TrezorTest): client.call_raw(proto.Cancel()) # Check current PIN value - self.check_pin(client, self.pin4) + self.check_pin(client, PIN4) # Let's change PIN ret = client.call_raw(proto.ChangePin()) @@ -88,12 +91,12 @@ class TestMsgChangepin(TrezorTest): # Send new PIN for first time assert isinstance(ret, proto.PinMatrixRequest) - pin_encoded = client.debug.encode_pin(self.pin6) + pin_encoded = client.debug.encode_pin(PIN6) ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) # Send the PIN for second time assert isinstance(ret, proto.PinMatrixRequest) - pin_encoded = client.debug.encode_pin(self.pin6) + pin_encoded = client.debug.encode_pin(PIN6) ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) # Now we're done @@ -104,7 +107,7 @@ class TestMsgChangepin(TrezorTest): assert features.pin_protection is True # Check that the PIN is correct - self.check_pin(client, self.pin6) + self.check_pin(client, PIN6) @pytest.mark.setup_client(mnemonic=MNEMONIC12, pin=True, passphrase=True) def test_remove_pin(self, client): @@ -157,12 +160,12 @@ class TestMsgChangepin(TrezorTest): # Send the PIN for first time assert isinstance(ret, proto.PinMatrixRequest) - pin_encoded = client.debug.encode_pin(self.pin6) + pin_encoded = client.debug.encode_pin(PIN6) ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) # Send the PIN for second time, but with typo assert isinstance(ret, proto.PinMatrixRequest) - pin_encoded = client.debug.encode_pin(self.pin4) + pin_encoded = client.debug.encode_pin(PIN4) ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) # Now it should fail, because pins are different @@ -194,12 +197,12 @@ class TestMsgChangepin(TrezorTest): # Send the PIN for first time assert isinstance(ret, proto.PinMatrixRequest) - pin_encoded = client.debug.encode_pin(self.pin6) + pin_encoded = client.debug.encode_pin(PIN6) ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) # Send the PIN for second time, but with typo assert isinstance(ret, proto.PinMatrixRequest) - pin_encoded = client.debug.encode_pin(self.pin6 + "3") + pin_encoded = client.debug.encode_pin(PIN6 + "3") ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) # Now it should fail, because pins are different @@ -208,7 +211,7 @@ class TestMsgChangepin(TrezorTest): # Check that there's still old PIN protection features = client.call_raw(proto.Initialize()) assert features.pin_protection is True - self.check_pin(client, self.pin4) + self.check_pin(client, PIN4) def check_pin(self, client, pin): client.clear_session() diff --git a/tests/device_tests/test_msg_cipherkeyvalue.py b/tests/device_tests/test_msg_cipherkeyvalue.py index c42b75bf3..e59f09c34 100644 --- a/tests/device_tests/test_msg_cipherkeyvalue.py +++ b/tests/device_tests/test_msg_cipherkeyvalue.py @@ -18,10 +18,10 @@ import pytest from trezorlib import misc -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 -class TestMsgCipherkeyvalue(TrezorTest): +class TestMsgCipherkeyvalue: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_encrypt(self, client): res = misc.encrypt_keyvalue( diff --git a/tests/device_tests/test_msg_clearsession.py b/tests/device_tests/test_msg_clearsession.py index e37c6c733..ce1e492c6 100644 --- a/tests/device_tests/test_msg_clearsession.py +++ b/tests/device_tests/test_msg_clearsession.py @@ -18,11 +18,9 @@ import pytest from trezorlib import messages as proto -from .common import TrezorTest - @pytest.mark.skip_t2 -class TestMsgClearsession(TrezorTest): +class TestMsgClearsession: @pytest.mark.setup_client(pin=True, passphrase=True) def test_clearsession(self, client): with client: diff --git a/tests/device_tests/test_msg_eos_get_public_key.py b/tests/device_tests/test_msg_eos_get_public_key.py index 9c9105593..64a29b8e0 100644 --- a/tests/device_tests/test_msg_eos_get_public_key.py +++ b/tests/device_tests/test_msg_eos_get_public_key.py @@ -19,13 +19,13 @@ import pytest from trezorlib.eos import get_public_key from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 @pytest.mark.altcoin @pytest.mark.eos @pytest.mark.skip_t1 -class TestMsgEosGetpublickey(TrezorTest): +class TestMsgEosGetpublickey: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_eos_get_public_key(self, client): public_key = get_public_key(client, parse_path("m/44'/194'/0'/0/0")) diff --git a/tests/device_tests/test_msg_eos_signtx.py b/tests/device_tests/test_msg_eos_signtx.py index b4ba05132..993c9b420 100644 --- a/tests/device_tests/test_msg_eos_signtx.py +++ b/tests/device_tests/test_msg_eos_signtx.py @@ -20,7 +20,7 @@ from trezorlib import eos from trezorlib.messages import EosSignedTx from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 CHAIN_ID = "cf057bbfb72640471fd910bcb67639c22df9f92470936cddc1ade0e2f2e7dc4f" ADDRESS_N = parse_path("m/44'/194'/0'/0/0") @@ -30,7 +30,7 @@ ADDRESS_N = parse_path("m/44'/194'/0'/0/0") @pytest.mark.eos @pytest.mark.skip_t1 @pytest.mark.setup_client(mnemonic=MNEMONIC12) -class TestMsgEosSignTx(TrezorTest): +class TestMsgEosSignTx: @pytest.mark.setup_client(uninitialized=True) def input_flow(self, debug, pages): # confirm number of actions diff --git a/tests/device_tests/test_msg_ethereum_getaddress.py b/tests/device_tests/test_msg_ethereum_getaddress.py index 2f0fc9bc3..76da18486 100644 --- a/tests/device_tests/test_msg_ethereum_getaddress.py +++ b/tests/device_tests/test_msg_ethereum_getaddress.py @@ -19,12 +19,12 @@ import pytest from trezorlib import ethereum from trezorlib.tools import H_ -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 @pytest.mark.altcoin @pytest.mark.ethereum -class TestMsgEthereumGetaddress(TrezorTest): +class TestMsgEthereumGetaddress: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_ethereum_getaddress(self, client): assert ( diff --git a/tests/device_tests/test_msg_ethereum_getpublickey.py b/tests/device_tests/test_msg_ethereum_getpublickey.py index 54068e13d..8e46d6cc5 100644 --- a/tests/device_tests/test_msg_ethereum_getpublickey.py +++ b/tests/device_tests/test_msg_ethereum_getpublickey.py @@ -19,12 +19,12 @@ import pytest from trezorlib import ethereum from trezorlib.tools import H_ -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 @pytest.mark.altcoin @pytest.mark.ethereum -class TestMsgEthereumGetPublicKey(TrezorTest): +class TestMsgEthereumGetPublicKey: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_ethereum_getpublickey(self, client): res = ethereum.get_public_node(client, [H_(44), H_(60), H_(0)]) diff --git a/tests/device_tests/test_msg_ethereum_signmessage.py b/tests/device_tests/test_msg_ethereum_signmessage.py index a66367ea8..2b0d1ffb6 100644 --- a/tests/device_tests/test_msg_ethereum_signmessage.py +++ b/tests/device_tests/test_msg_ethereum_signmessage.py @@ -19,12 +19,12 @@ import pytest from trezorlib import ethereum from trezorlib.tools import H_ -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 @pytest.mark.altcoin @pytest.mark.ethereum -class TestMsgEthereumSignmessage(TrezorTest): +class TestMsgEthereumSignmessage: PATH = [H_(44), H_(60), H_(0), 0] ADDRESS = "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b" diff --git a/tests/device_tests/test_msg_ethereum_signtx.py b/tests/device_tests/test_msg_ethereum_signtx.py index 5917c056a..3d61efc05 100644 --- a/tests/device_tests/test_msg_ethereum_signtx.py +++ b/tests/device_tests/test_msg_ethereum_signtx.py @@ -20,14 +20,14 @@ from trezorlib import ethereum, messages from trezorlib.exceptions import TrezorFailure from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 TO_ADDR = "0x1d1c328764a41bda0492b66baa30c4a339ff85ef" @pytest.mark.altcoin @pytest.mark.ethereum -class TestMsgEthereumSigntx(TrezorTest): +class TestMsgEthereumSigntx: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_ethereum_signtx_known_erc20_token(self, client): with client: diff --git a/tests/device_tests/test_msg_ethereum_verifymessage.py b/tests/device_tests/test_msg_ethereum_verifymessage.py index 007328ffe..86b5dc730 100644 --- a/tests/device_tests/test_msg_ethereum_verifymessage.py +++ b/tests/device_tests/test_msg_ethereum_verifymessage.py @@ -18,12 +18,10 @@ import pytest from trezorlib import ethereum -from .common import TrezorTest - @pytest.mark.altcoin @pytest.mark.ethereum -class TestMsgEthereumVerifymessage(TrezorTest): +class TestMsgEthereumVerifymessage: ADDRESS = "0xEa53AF85525B1779eE99ece1a5560C0b78537C3b" VECTORS = [ diff --git a/tests/device_tests/test_msg_getaddress.py b/tests/device_tests/test_msg_getaddress.py index 98d2c870a..963a82289 100644 --- a/tests/device_tests/test_msg_getaddress.py +++ b/tests/device_tests/test_msg_getaddress.py @@ -19,7 +19,7 @@ import pytest from trezorlib import btc, ckd_public as bip32, messages as proto from trezorlib.tools import H_, CallException, parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 def getmultisig(chain, nr, xpubs, signatures=[b"", b"", b""]): @@ -31,7 +31,7 @@ def getmultisig(chain, nr, xpubs, signatures=[b"", b"", b""]): ) -class TestMsgGetaddress(TrezorTest): +class TestMsgGetaddress: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_btc(self, client): assert ( diff --git a/tests/device_tests/test_msg_getaddress_segwit.py b/tests/device_tests/test_msg_getaddress_segwit.py index 3086c73e6..5dd47ea0b 100644 --- a/tests/device_tests/test_msg_getaddress_segwit.py +++ b/tests/device_tests/test_msg_getaddress_segwit.py @@ -19,10 +19,8 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from .common import TrezorTest - -class TestMsgGetaddressSegwit(TrezorTest): +class TestMsgGetaddressSegwit: def test_show_segwit(self, client): assert ( btc.get_address( diff --git a/tests/device_tests/test_msg_getaddress_segwit_native.py b/tests/device_tests/test_msg_getaddress_segwit_native.py index 82b8f422a..e314466ac 100644 --- a/tests/device_tests/test_msg_getaddress_segwit_native.py +++ b/tests/device_tests/test_msg_getaddress_segwit_native.py @@ -19,10 +19,8 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from .common import TrezorTest - -class TestMsgGetaddressSegwitNative(TrezorTest): +class TestMsgGetaddressSegwitNative: def test_show_segwit(self, client): assert ( btc.get_address( diff --git a/tests/device_tests/test_msg_getaddress_show.py b/tests/device_tests/test_msg_getaddress_show.py index f69f804ed..5af692c04 100644 --- a/tests/device_tests/test_msg_getaddress_show.py +++ b/tests/device_tests/test_msg_getaddress_show.py @@ -18,10 +18,10 @@ import pytest from trezorlib import btc, ckd_public as bip32, messages as proto -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 -class TestMsgGetaddressShow(TrezorTest): +class TestMsgGetaddressShow: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_show(self, client): assert ( diff --git a/tests/device_tests/test_msg_getecdhsessionkey.py b/tests/device_tests/test_msg_getecdhsessionkey.py index eb8a8376f..0d038f0b7 100644 --- a/tests/device_tests/test_msg_getecdhsessionkey.py +++ b/tests/device_tests/test_msg_getecdhsessionkey.py @@ -18,10 +18,10 @@ import pytest from trezorlib import messages as proto, misc -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 -class TestMsgGetECDHSessionKey(TrezorTest): +class TestMsgGetECDHSessionKey: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_ecdh(self, client): identity = proto.IdentityType( diff --git a/tests/device_tests/test_msg_getpublickey.py b/tests/device_tests/test_msg_getpublickey.py index 49c7b57a5..522d99055 100644 --- a/tests/device_tests/test_msg_getpublickey.py +++ b/tests/device_tests/test_msg_getpublickey.py @@ -19,10 +19,10 @@ import pytest from trezorlib import btc, ckd_public as bip32, messages as proto from trezorlib.tools import H_ -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 -class TestMsgGetpublickey(TrezorTest): +class TestMsgGetpublickey: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_btc(self, client): assert ( diff --git a/tests/device_tests/test_msg_getpublickey_curve.py b/tests/device_tests/test_msg_getpublickey_curve.py index 95904ea3b..cf919e20b 100644 --- a/tests/device_tests/test_msg_getpublickey_curve.py +++ b/tests/device_tests/test_msg_getpublickey_curve.py @@ -19,10 +19,10 @@ import pytest from trezorlib import btc from trezorlib.tools import H_, CallException -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 -class TestMsgGetpublickeyCurve(TrezorTest): +class TestMsgGetpublickeyCurve: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_default_curve(self, client): assert ( diff --git a/tests/device_tests/test_msg_lisk_getaddress.py b/tests/device_tests/test_msg_lisk_getaddress.py index 62ddf60c4..b6ed01434 100644 --- a/tests/device_tests/test_msg_lisk_getaddress.py +++ b/tests/device_tests/test_msg_lisk_getaddress.py @@ -19,14 +19,14 @@ import pytest from trezorlib import lisk from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 LISK_PATH = parse_path("m/44h/134h/0h/1h") @pytest.mark.altcoin @pytest.mark.lisk -class TestMsgLiskGetaddress(TrezorTest): +class TestMsgLiskGetaddress: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_lisk_getaddress(self, client): assert lisk.get_address(client, LISK_PATH[:2]) == "1431530009238518937L" diff --git a/tests/device_tests/test_msg_lisk_getpublickey.py b/tests/device_tests/test_msg_lisk_getpublickey.py index f18bba39a..ee228720c 100644 --- a/tests/device_tests/test_msg_lisk_getpublickey.py +++ b/tests/device_tests/test_msg_lisk_getpublickey.py @@ -19,14 +19,14 @@ import pytest from trezorlib import lisk from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 LISK_PATH = parse_path("m/44h/134h/0h/0h") @pytest.mark.altcoin @pytest.mark.lisk -class TestMsgLiskGetPublicKey(TrezorTest): +class TestMsgLiskGetPublicKey: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_lisk_get_public_key(self, client): sig = lisk.get_public_key(client, LISK_PATH) diff --git a/tests/device_tests/test_msg_lisk_signmessage.py b/tests/device_tests/test_msg_lisk_signmessage.py index cdba8abfa..f7f3e381d 100644 --- a/tests/device_tests/test_msg_lisk_signmessage.py +++ b/tests/device_tests/test_msg_lisk_signmessage.py @@ -19,14 +19,14 @@ import pytest from trezorlib import lisk from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 LISK_PATH = parse_path("m/44h/134h/0h/0h") @pytest.mark.altcoin @pytest.mark.lisk -class TestMsgLiskSignmessage(TrezorTest): +class TestMsgLiskSignmessage: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_sign(self, client): sig = lisk.sign_message( diff --git a/tests/device_tests/test_msg_lisk_signtx.py b/tests/device_tests/test_msg_lisk_signtx.py index 53bfccd27..f3ea1c36a 100644 --- a/tests/device_tests/test_msg_lisk_signtx.py +++ b/tests/device_tests/test_msg_lisk_signtx.py @@ -19,12 +19,10 @@ import pytest from trezorlib import lisk, messages as proto from trezorlib.tools import parse_path -from .common import TrezorTest - @pytest.mark.altcoin @pytest.mark.lisk -class TestMsgLiskSignTx(TrezorTest): +class TestMsgLiskSignTx: def test_lisk_sign_tx_send(self, client): with client: client.set_expected_responses( diff --git a/tests/device_tests/test_msg_lisk_verifymessage.py b/tests/device_tests/test_msg_lisk_verifymessage.py index a1294d06e..995f63871 100644 --- a/tests/device_tests/test_msg_lisk_verifymessage.py +++ b/tests/device_tests/test_msg_lisk_verifymessage.py @@ -18,12 +18,10 @@ import pytest from trezorlib import lisk, messages as proto -from .common import TrezorTest - @pytest.mark.altcoin @pytest.mark.lisk -class TestMsgLiskVerifymessage(TrezorTest): +class TestMsgLiskVerifymessage: def test_verify(self, client): with client: client.set_expected_responses( diff --git a/tests/device_tests/test_msg_loaddevice.py b/tests/device_tests/test_msg_loaddevice.py index 870a10d1a..be0c0fa9a 100644 --- a/tests/device_tests/test_msg_loaddevice.py +++ b/tests/device_tests/test_msg_loaddevice.py @@ -19,11 +19,11 @@ import pytest from trezorlib import btc, debuglink, device from trezorlib.messages.PassphraseSourceType import HOST as PASSPHRASE_ON_HOST -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 @pytest.mark.setup_client(uninitialized=True) -class TestDeviceLoad(TrezorTest): +class TestDeviceLoad: def test_load_device_1(self, client): debuglink.load_device_by_mnemonic( client, diff --git a/tests/device_tests/test_msg_loaddevice_xprv.py b/tests/device_tests/test_msg_loaddevice_xprv.py index f2ec3cbf4..17473b0e7 100644 --- a/tests/device_tests/test_msg_loaddevice_xprv.py +++ b/tests/device_tests/test_msg_loaddevice_xprv.py @@ -18,11 +18,9 @@ import pytest from trezorlib import btc, debuglink -from .common import TrezorTest - @pytest.mark.skip_t2 -class TestDeviceLoadXprv(TrezorTest): +class TestDeviceLoadXprv: @pytest.mark.setup_client(uninitialized=True) def test_load_device_xprv_1(self, client): debuglink.load_device_by_xprv( diff --git a/tests/device_tests/test_msg_monero_getaddress.py b/tests/device_tests/test_msg_monero_getaddress.py index 772ee6245..17bada214 100644 --- a/tests/device_tests/test_msg_monero_getaddress.py +++ b/tests/device_tests/test_msg_monero_getaddress.py @@ -19,13 +19,13 @@ import pytest from trezorlib import monero from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 @pytest.mark.altcoin @pytest.mark.monero @pytest.mark.skip_t1 -class TestMsgMoneroGetaddress(TrezorTest): +class TestMsgMoneroGetaddress: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_monero_getaddress(self, client): assert ( diff --git a/tests/device_tests/test_msg_monero_getwatchkey.py b/tests/device_tests/test_msg_monero_getwatchkey.py index 5e5a8ddcd..e2d1ddd42 100644 --- a/tests/device_tests/test_msg_monero_getwatchkey.py +++ b/tests/device_tests/test_msg_monero_getwatchkey.py @@ -19,13 +19,13 @@ import pytest from trezorlib import monero from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 @pytest.mark.altcoin @pytest.mark.monero @pytest.mark.skip_t1 -class TestMsgMoneroGetwatchkey(TrezorTest): +class TestMsgMoneroGetwatchkey: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_monero_getwatchkey(self, client): res = monero.get_watch_key(client, parse_path("m/44h/128h/0h")) diff --git a/tests/device_tests/test_msg_nem_getaddress.py b/tests/device_tests/test_msg_nem_getaddress.py index 376b158dd..1a33e1aba 100644 --- a/tests/device_tests/test_msg_nem_getaddress.py +++ b/tests/device_tests/test_msg_nem_getaddress.py @@ -19,12 +19,12 @@ import pytest from trezorlib import nem from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 @pytest.mark.altcoin @pytest.mark.nem -class TestMsgNEMGetaddress(TrezorTest): +class TestMsgNEMGetaddress: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_nem_getaddress(self, client): assert ( diff --git a/tests/device_tests/test_msg_nem_signtx_mosaics.py b/tests/device_tests/test_msg_nem_signtx_mosaics.py index 7e6485932..5e46ed9a5 100644 --- a/tests/device_tests/test_msg_nem_signtx_mosaics.py +++ b/tests/device_tests/test_msg_nem_signtx_mosaics.py @@ -19,14 +19,14 @@ import pytest from trezorlib import nem from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 # assertion data from T1 @pytest.mark.altcoin @pytest.mark.nem @pytest.mark.skip_t2 -class TestMsgNEMSignTxMosaics(TrezorTest): +class TestMsgNEMSignTxMosaics: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_nem_signtx_mosaic_supply_change(self, client): tx = nem.sign_tx( diff --git a/tests/device_tests/test_msg_nem_signtx_mosaics_t2.py b/tests/device_tests/test_msg_nem_signtx_mosaics_t2.py index b815268e9..a88f77d2a 100644 --- a/tests/device_tests/test_msg_nem_signtx_mosaics_t2.py +++ b/tests/device_tests/test_msg_nem_signtx_mosaics_t2.py @@ -20,14 +20,14 @@ from trezorlib import messages as proto, nem from trezorlib.messages import ButtonRequestType as B from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 # assertion data from T1 @pytest.mark.altcoin @pytest.mark.nem @pytest.mark.skip_t1 -class TestMsgNEMSignTxMosaics(TrezorTest): +class TestMsgNEMSignTxMosaics: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_nem_signtx_mosaic_supply_change(self, client): with client: diff --git a/tests/device_tests/test_msg_nem_signtx_multisig.py b/tests/device_tests/test_msg_nem_signtx_multisig.py index d8c0d11a2..1d706b2af 100644 --- a/tests/device_tests/test_msg_nem_signtx_multisig.py +++ b/tests/device_tests/test_msg_nem_signtx_multisig.py @@ -19,13 +19,13 @@ import pytest from trezorlib import nem from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 # assertion data from T1 @pytest.mark.altcoin @pytest.mark.nem -class TestMsgNEMSignTxMultisig(TrezorTest): +class TestMsgNEMSignTxMultisig: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_nem_signtx_aggregate_modification(self, client): tx = nem.sign_tx( diff --git a/tests/device_tests/test_msg_nem_signtx_others.py b/tests/device_tests/test_msg_nem_signtx_others.py index fcb134509..2e57b6124 100644 --- a/tests/device_tests/test_msg_nem_signtx_others.py +++ b/tests/device_tests/test_msg_nem_signtx_others.py @@ -19,13 +19,13 @@ import pytest from trezorlib import nem from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 # assertion data from T1 @pytest.mark.altcoin @pytest.mark.nem -class TestMsgNEMSignTxOther(TrezorTest): +class TestMsgNEMSignTxOther: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_nem_signtx_importance_transfer(self, client): with client: diff --git a/tests/device_tests/test_msg_nem_signtx_transfers.py b/tests/device_tests/test_msg_nem_signtx_transfers.py index 2b3af9f86..27463c056 100644 --- a/tests/device_tests/test_msg_nem_signtx_transfers.py +++ b/tests/device_tests/test_msg_nem_signtx_transfers.py @@ -19,13 +19,13 @@ import pytest from trezorlib import messages as proto, nem from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 # assertion data from T1 @pytest.mark.altcoin @pytest.mark.nem -class TestMsgNEMSignTx(TrezorTest): +class TestMsgNEMSignTx: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_nem_signtx_simple(self, client): with client: diff --git a/tests/device_tests/test_msg_ping.py b/tests/device_tests/test_msg_ping.py index 0dc58fe40..29c5f1c5a 100644 --- a/tests/device_tests/test_msg_ping.py +++ b/tests/device_tests/test_msg_ping.py @@ -18,11 +18,9 @@ import pytest from trezorlib import messages as proto -from .common import TrezorTest - @pytest.mark.skip_t2 -class TestMsgPing(TrezorTest): +class TestMsgPing: @pytest.mark.setup_client(pin=True, passphrase=True) def test_ping(self, client): with client: diff --git a/tests/device_tests/test_msg_recoverydevice.py b/tests/device_tests/test_msg_recoverydevice.py index ea6c9850f..2232f152d 100644 --- a/tests/device_tests/test_msg_recoverydevice.py +++ b/tests/device_tests/test_msg_recoverydevice.py @@ -18,14 +18,17 @@ import pytest from trezorlib import device, messages as proto -from .common import TrezorTest +from .common import MNEMONIC12 + +PIN4 = "1234" +PIN6 = "789456" @pytest.mark.skip_t2 -class TestMsgRecoverydevice(TrezorTest): +class TestMsgRecoverydevice: @pytest.mark.setup_client(uninitialized=True) def test_pin_passphrase(self, client): - mnemonic = self.mnemonic12.split(" ") + mnemonic = MNEMONIC12.split(" ") ret = client.call_raw( proto.RecoveryDevice( word_count=12, @@ -45,12 +48,12 @@ class TestMsgRecoverydevice(TrezorTest): assert isinstance(ret, proto.PinMatrixRequest) # Enter PIN for first time - pin_encoded = client.debug.encode_pin(self.pin6) + pin_encoded = client.debug.encode_pin(PIN6) ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) assert isinstance(ret, proto.PinMatrixRequest) # Enter PIN for second time - pin_encoded = client.debug.encode_pin(self.pin6) + pin_encoded = client.debug.encode_pin(PIN6) ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) fakes = 0 @@ -76,7 +79,7 @@ class TestMsgRecoverydevice(TrezorTest): # Mnemonic is the same client.init_device() - assert client.debug.read_mnemonic_secret() == self.mnemonic12.encode() + assert client.debug.read_mnemonic_secret() == MNEMONIC12.encode() assert client.features.pin_protection is True assert client.features.passphrase_protection is True @@ -88,7 +91,7 @@ class TestMsgRecoverydevice(TrezorTest): @pytest.mark.setup_client(uninitialized=True) def test_nopin_nopassphrase(self, client): - mnemonic = self.mnemonic12.split(" ") + mnemonic = MNEMONIC12.split(" ") ret = client.call_raw( proto.RecoveryDevice( word_count=12, @@ -128,7 +131,7 @@ class TestMsgRecoverydevice(TrezorTest): # Mnemonic is the same client.init_device() - assert client.debug.read_mnemonic_secret() == self.mnemonic12.encode() + assert client.debug.read_mnemonic_secret() == MNEMONIC12.encode() assert client.features.pin_protection is False assert client.features.passphrase_protection is False @@ -190,12 +193,12 @@ class TestMsgRecoverydevice(TrezorTest): assert isinstance(ret, proto.PinMatrixRequest) # Enter PIN for first time - pin_encoded = client.debug.encode_pin(self.pin4) + pin_encoded = client.debug.encode_pin(PIN4) ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) assert isinstance(ret, proto.PinMatrixRequest) # Enter PIN for second time, but different one - pin_encoded = client.debug.encode_pin(self.pin6) + pin_encoded = client.debug.encode_pin(PIN6) ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) # Failure should be raised diff --git a/tests/device_tests/test_msg_recoverydevice_dryrun.py b/tests/device_tests/test_msg_recoverydevice_dryrun.py index 37b25848d..4eb1b15f1 100644 --- a/tests/device_tests/test_msg_recoverydevice_dryrun.py +++ b/tests/device_tests/test_msg_recoverydevice_dryrun.py @@ -18,11 +18,11 @@ import pytest from trezorlib import messages as proto -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 @pytest.mark.skip_t2 -class TestMsgRecoverydeviceDryrun(TrezorTest): +class TestMsgRecoverydeviceDryrun: def recovery_loop(self, client, mnemonic, result): ret = client.call_raw( proto.RecoveryDevice( diff --git a/tests/device_tests/test_msg_recoverydevice_t2.py b/tests/device_tests/test_msg_recoverydevice_t2.py index 8b72ae376..39ec03054 100644 --- a/tests/device_tests/test_msg_recoverydevice_t2.py +++ b/tests/device_tests/test_msg_recoverydevice_t2.py @@ -18,14 +18,14 @@ import pytest from trezorlib import device, messages as proto -from .common import TrezorTest +from .common import MNEMONIC12 @pytest.mark.skip_t1 -class TestMsgRecoverydeviceT2(TrezorTest): +class TestMsgRecoverydeviceT2: @pytest.mark.setup_client(uninitialized=True) def test_pin_passphrase(self, client): - mnemonic = self.mnemonic12.split(" ") + mnemonic = MNEMONIC12.split(" ") ret = client.call_raw( proto.RecoveryDevice( passphrase_protection=True, @@ -84,14 +84,14 @@ class TestMsgRecoverydeviceT2(TrezorTest): # Mnemonic is the same client.init_device() - assert client.debug.read_mnemonic_secret() == self.mnemonic12.encode() + assert client.debug.read_mnemonic_secret() == MNEMONIC12.encode() assert client.features.pin_protection is True assert client.features.passphrase_protection is True @pytest.mark.setup_client(uninitialized=True) def test_nopin_nopassphrase(self, client): - mnemonic = self.mnemonic12.split(" ") + mnemonic = MNEMONIC12.split(" ") ret = client.call_raw( proto.RecoveryDevice( passphrase_protection=False, @@ -140,7 +140,7 @@ class TestMsgRecoverydeviceT2(TrezorTest): # Mnemonic is the same client.init_device() - assert client.debug.read_mnemonic_secret() == self.mnemonic12.encode() + assert client.debug.read_mnemonic_secret() == MNEMONIC12.encode() assert client.features.pin_protection is False assert client.features.passphrase_protection is False diff --git a/tests/device_tests/test_msg_resetdevice.py b/tests/device_tests/test_msg_resetdevice.py index 223b4c90d..42d49a49c 100644 --- a/tests/device_tests/test_msg_resetdevice.py +++ b/tests/device_tests/test_msg_resetdevice.py @@ -19,11 +19,11 @@ from mnemonic import Mnemonic from trezorlib import device, messages as proto -from .common import TrezorTest, generate_entropy +from .common import generate_entropy @pytest.mark.skip_t2 -class TestMsgResetDevice(TrezorTest): +class TestMsgResetDevice: @pytest.mark.setup_client(uninitialized=True) def test_reset_device(self, client): # No PIN, no passphrase @@ -218,12 +218,12 @@ class TestMsgResetDevice(TrezorTest): assert isinstance(ret, proto.PinMatrixRequest) # Enter PIN for first time - pin_encoded = client.debug.encode_pin(self.pin4) + pin_encoded = client.debug.encode_pin("1234") ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) assert isinstance(ret, proto.PinMatrixRequest) # Enter PIN for second time - pin_encoded = client.debug.encode_pin(self.pin6) + pin_encoded = client.debug.encode_pin("6789") ret = client.call_raw(proto.PinMatrixAck(pin=pin_encoded)) assert isinstance(ret, proto.Failure) diff --git a/tests/device_tests/test_msg_resetdevice_nobackup.py b/tests/device_tests/test_msg_resetdevice_nobackup.py index cc3559768..d4e9c2ea4 100644 --- a/tests/device_tests/test_msg_resetdevice_nobackup.py +++ b/tests/device_tests/test_msg_resetdevice_nobackup.py @@ -18,10 +18,8 @@ import pytest from trezorlib import messages as proto -from .common import TrezorTest - -class TestMsgResetDeviceNobackup(TrezorTest): +class TestMsgResetDeviceNobackup: external_entropy = b"zlutoucky kun upel divoke ody" * 2 strength = 128 diff --git a/tests/device_tests/test_msg_resetdevice_skipbackup.py b/tests/device_tests/test_msg_resetdevice_skipbackup.py index 5f46cbb58..2ee5e4876 100644 --- a/tests/device_tests/test_msg_resetdevice_skipbackup.py +++ b/tests/device_tests/test_msg_resetdevice_skipbackup.py @@ -19,11 +19,11 @@ from mnemonic import Mnemonic from trezorlib import messages as proto -from .common import TrezorTest, generate_entropy +from .common import generate_entropy @pytest.mark.skip_t2 -class TestMsgResetDeviceSkipbackup(TrezorTest): +class TestMsgResetDeviceSkipbackup: external_entropy = b"zlutoucky kun upel divoke ody" * 2 strength = 128 diff --git a/tests/device_tests/test_msg_ripple_get_address.py b/tests/device_tests/test_msg_ripple_get_address.py index c6b091360..0cb8617a9 100644 --- a/tests/device_tests/test_msg_ripple_get_address.py +++ b/tests/device_tests/test_msg_ripple_get_address.py @@ -19,8 +19,6 @@ import pytest from trezorlib.ripple import get_address from trezorlib.tools import parse_path -from .common import TrezorTest - CUSTOM_MNEMONIC = ( "armed bundle pudding lazy strategy impulse where identify " "submit weekend physical antenna flight social acoustic absurd " @@ -31,7 +29,7 @@ CUSTOM_MNEMONIC = ( @pytest.mark.altcoin @pytest.mark.ripple @pytest.mark.skip_t1 # T1 support is not planned -class TestMsgRippleGetAddress(TrezorTest): +class TestMsgRippleGetAddress: def test_ripple_get_address(self, client): # data from https://iancoleman.io/bip39/#english address = get_address(client, parse_path("m/44'/144'/0'/0/0")) diff --git a/tests/device_tests/test_msg_ripple_sign_tx.py b/tests/device_tests/test_msg_ripple_sign_tx.py index 705821592..e774a3d89 100644 --- a/tests/device_tests/test_msg_ripple_sign_tx.py +++ b/tests/device_tests/test_msg_ripple_sign_tx.py @@ -19,13 +19,11 @@ import pytest from trezorlib import messages, ripple from trezorlib.tools import CallException, parse_path -from .common import TrezorTest - @pytest.mark.altcoin @pytest.mark.ripple @pytest.mark.skip_t1 # T1 support is not planned -class TestMsgRippleSignTx(TrezorTest): +class TestMsgRippleSignTx: def test_ripple_sign_simple_tx(self, client): msg = ripple.create_sign_tx_msg( { diff --git a/tests/device_tests/test_msg_signidentity.py b/tests/device_tests/test_msg_signidentity.py index 2b44890f3..eee698f92 100644 --- a/tests/device_tests/test_msg_signidentity.py +++ b/tests/device_tests/test_msg_signidentity.py @@ -21,7 +21,7 @@ import pytest from trezorlib import messages as proto, misc from trezorlib.tools import H_ -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 def check_path(identity): @@ -47,7 +47,7 @@ def check_path(identity): print("path:", "m/" + "/".join([str(x) for x in address_n])) -class TestMsgSignidentity(TrezorTest): +class TestMsgSignidentity: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_sign(self, client): hidden = bytes.fromhex( diff --git a/tests/device_tests/test_msg_signmessage.py b/tests/device_tests/test_msg_signmessage.py index 2a376172b..b009c8d90 100644 --- a/tests/device_tests/test_msg_signmessage.py +++ b/tests/device_tests/test_msg_signmessage.py @@ -21,10 +21,10 @@ import pytest from trezorlib import btc from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 -class TestMsgSignmessage(TrezorTest): +class TestMsgSignmessage: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_sign(self, client): sig = btc.sign_message( diff --git a/tests/device_tests/test_msg_signmessage_decred.py b/tests/device_tests/test_msg_signmessage_decred.py index 0304aa933..a83a6dd53 100644 --- a/tests/device_tests/test_msg_signmessage_decred.py +++ b/tests/device_tests/test_msg_signmessage_decred.py @@ -19,12 +19,12 @@ import pytest from trezorlib import btc from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 @pytest.mark.altcoin @pytest.mark.decred -class TestMsgSignmessageDecred(TrezorTest): +class TestMsgSignmessageDecred: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_sign_mainnet(self, client): address_n = parse_path("m/44'/42'/0'/0/0") diff --git a/tests/device_tests/test_msg_signmessage_segwit.py b/tests/device_tests/test_msg_signmessage_segwit.py index 453c77037..bcd48d467 100644 --- a/tests/device_tests/test_msg_signmessage_segwit.py +++ b/tests/device_tests/test_msg_signmessage_segwit.py @@ -21,10 +21,10 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 -class TestMsgSignmessageSegwit(TrezorTest): +class TestMsgSignmessageSegwit: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_sign(self, client): sig = btc.sign_message( diff --git a/tests/device_tests/test_msg_signmessage_segwit_native.py b/tests/device_tests/test_msg_signmessage_segwit_native.py index 6ab3270c3..d05ff72f8 100644 --- a/tests/device_tests/test_msg_signmessage_segwit_native.py +++ b/tests/device_tests/test_msg_signmessage_segwit_native.py @@ -21,10 +21,10 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 -class TestMsgSignmessageSegwitNative(TrezorTest): +class TestMsgSignmessageSegwitNative: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_sign(self, client): sig = btc.sign_message( diff --git a/tests/device_tests/test_msg_signtx.py b/tests/device_tests/test_msg_signtx.py index 17d43ad76..3e9df3c4e 100644 --- a/tests/device_tests/test_msg_signtx.py +++ b/tests/device_tests/test_msg_signtx.py @@ -19,7 +19,7 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import H_, CallException, btc_hash, parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 from .conftest import TREZOR_VERSION from .tx_cache import tx_cache @@ -151,7 +151,7 @@ def check_sign_tx( return btc.sign_tx(client, coin_name, inputs, outputs, prev_txes=txes) -class TestMsgSigntx(TrezorTest): +class TestMsgSigntx: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_one_one_fee(self, client): # tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882 diff --git a/tests/device_tests/test_msg_signtx_bcash.py b/tests/device_tests/test_msg_signtx_bcash.py index 36604c113..56a44ee47 100644 --- a/tests/device_tests/test_msg_signtx_bcash.py +++ b/tests/device_tests/test_msg_signtx_bcash.py @@ -19,14 +19,13 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import H_, CallException, parse_path -from .common import TrezorTest from .tx_cache import tx_cache TX_API = tx_cache("Bcash") @pytest.mark.altcoin -class TestMsgSigntxBch(TrezorTest): +class TestMsgSigntxBch: def test_send_bch_change(self, client): inp1 = proto.TxInputType( address_n=parse_path("44'/145'/0'/0/0"), diff --git a/tests/device_tests/test_msg_signtx_bgold.py b/tests/device_tests/test_msg_signtx_bgold.py index c11af1c61..f40b8176f 100644 --- a/tests/device_tests/test_msg_signtx_bgold.py +++ b/tests/device_tests/test_msg_signtx_bgold.py @@ -19,7 +19,6 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import H_, CallException, parse_path -from .common import TrezorTest from .tx_cache import tx_cache TX_API = tx_cache("Bgold") @@ -27,7 +26,7 @@ TX_API = tx_cache("Bgold") # All data taken from T1 @pytest.mark.altcoin -class TestMsgSigntxBitcoinGold(TrezorTest): +class TestMsgSigntxBitcoinGold: def test_send_bitcoin_gold_change(self, client): inp1 = proto.TxInputType( address_n=parse_path("44'/156'/0'/0/0"), diff --git a/tests/device_tests/test_msg_signtx_dash.py b/tests/device_tests/test_msg_signtx_dash.py index a36d8a731..65b3ad0c7 100644 --- a/tests/device_tests/test_msg_signtx_dash.py +++ b/tests/device_tests/test_msg_signtx_dash.py @@ -19,14 +19,13 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from .common import TrezorTest from .tx_cache import tx_cache TX_API = tx_cache("Dash") @pytest.mark.altcoin -class TestMsgSigntxDash(TrezorTest): +class TestMsgSigntxDash: def test_send_dash(self, client): inp1 = proto.TxInputType( address_n=parse_path("44'/5'/0'/0/0"), diff --git a/tests/device_tests/test_msg_signtx_decred.py b/tests/device_tests/test_msg_signtx_decred.py index 501197cca..057c94540 100644 --- a/tests/device_tests/test_msg_signtx_decred.py +++ b/tests/device_tests/test_msg_signtx_decred.py @@ -19,7 +19,6 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from .common import TrezorTest from .tx_cache import tx_cache TX_API = tx_cache("Decred Testnet") @@ -47,7 +46,7 @@ TXHASH_16da18 = bytes.fromhex( @pytest.mark.altcoin @pytest.mark.decred -class TestMsgSigntxDecred(TrezorTest): +class TestMsgSigntxDecred: def test_send_decred(self, client): inp1 = proto.TxInputType( # TscqTv1he8MZrV321SfRghw7LFBCJDKB3oz diff --git a/tests/device_tests/test_msg_signtx_grs.py b/tests/device_tests/test_msg_signtx_grs.py index c9ab5d022..9f1bf48b9 100644 --- a/tests/device_tests/test_msg_signtx_grs.py +++ b/tests/device_tests/test_msg_signtx_grs.py @@ -19,14 +19,13 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from .common import TrezorTest from .tx_cache import tx_cache TX_API = tx_cache("Groestlcoin") @pytest.mark.altcoin -class TestMsgSigntxGRS(TrezorTest): +class TestMsgSigntxGRS: def test_legacy(self, client): inp1 = proto.TxInputType( address_n=parse_path( diff --git a/tests/device_tests/test_msg_signtx_komodo.py b/tests/device_tests/test_msg_signtx_komodo.py index b22bcdab2..5d03e5ad4 100644 --- a/tests/device_tests/test_msg_signtx_komodo.py +++ b/tests/device_tests/test_msg_signtx_komodo.py @@ -19,7 +19,6 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from .common import TrezorTest from .conftest import TREZOR_VERSION from .tx_cache import tx_cache @@ -36,7 +35,7 @@ TXHASH_7b28bd = bytes.fromhex( @pytest.mark.altcoin @pytest.mark.komodo -class TestMsgSigntxKomodo(TrezorTest): +class TestMsgSigntxKomodo: def test_one_one_fee_sapling(self, client): # prevout: 2807c5b126ec8e2b078cab0f12e4c8b4ce1d7724905f8ebef8dca26b0c8e0f1d:0 # input 1: 10.9998 KMD diff --git a/tests/device_tests/test_msg_signtx_segwit.py b/tests/device_tests/test_msg_signtx_segwit.py index 52b7412a4..c905367f7 100644 --- a/tests/device_tests/test_msg_signtx_segwit.py +++ b/tests/device_tests/test_msg_signtx_segwit.py @@ -19,14 +19,13 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import H_, CallException, parse_path -from .common import TrezorTest from .conftest import TREZOR_VERSION from .tx_cache import tx_cache TX_API = tx_cache("Testnet") -class TestMsgSigntxSegwit(TrezorTest): +class TestMsgSigntxSegwit: def test_send_p2sh(self, client): inp1 = proto.TxInputType( address_n=parse_path("49'/1'/0'/1/0"), diff --git a/tests/device_tests/test_msg_signtx_segwit_native.py b/tests/device_tests/test_msg_signtx_segwit_native.py index 663894d5b..4569f2be2 100644 --- a/tests/device_tests/test_msg_signtx_segwit_native.py +++ b/tests/device_tests/test_msg_signtx_segwit_native.py @@ -18,13 +18,12 @@ from trezorlib import btc, messages as proto from trezorlib.ckd_public import deserialize from trezorlib.tools import H_, parse_path -from .common import TrezorTest from .tx_cache import tx_cache TX_API = tx_cache("Testnet") -class TestMsgSigntxSegwitNative(TrezorTest): +class TestMsgSigntxSegwitNative: def test_send_p2sh(self, client): inp1 = proto.TxInputType( address_n=parse_path("49'/1'/0'/1/0"), diff --git a/tests/device_tests/test_msg_signtx_zcash.py b/tests/device_tests/test_msg_signtx_zcash.py index 2b2b27262..8168f6022 100644 --- a/tests/device_tests/test_msg_signtx_zcash.py +++ b/tests/device_tests/test_msg_signtx_zcash.py @@ -19,7 +19,6 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import parse_path -from .common import TrezorTest from .tx_cache import tx_cache TX_API = tx_cache("Zcash Testnet") @@ -34,7 +33,7 @@ TXHASH_e38206 = bytes.fromhex( @pytest.mark.altcoin @pytest.mark.zcash -class TestMsgSigntxZcash(TrezorTest): +class TestMsgSigntxZcash: def test_one_one_fee_overwinter(self, client): # prevout: aaf51e4606c264e47e5c42c958fe4cf1539c5172684721e38e69f4ef634d75dc:1 # input 1: 3.0 TAZ diff --git a/tests/device_tests/test_msg_stellar_get_address.py b/tests/device_tests/test_msg_stellar_get_address.py index 8d72e661c..b0775f52a 100644 --- a/tests/device_tests/test_msg_stellar_get_address.py +++ b/tests/device_tests/test_msg_stellar_get_address.py @@ -19,13 +19,13 @@ import pytest from trezorlib import messages as proto, stellar from trezorlib.tools import CallException, parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 from .conftest import TREZOR_VERSION @pytest.mark.altcoin @pytest.mark.stellar -class TestMsgStellarGetAddress(TrezorTest): +class TestMsgStellarGetAddress: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_stellar_get_address(self, client): address = stellar.get_address(client, parse_path(stellar.DEFAULT_BIP32_PATH)) diff --git a/tests/device_tests/test_msg_stellar_sign_transaction.py b/tests/device_tests/test_msg_stellar_sign_transaction.py index 624060309..9f03d7a15 100644 --- a/tests/device_tests/test_msg_stellar_sign_transaction.py +++ b/tests/device_tests/test_msg_stellar_sign_transaction.py @@ -53,12 +53,12 @@ import pytest from trezorlib import messages as proto, stellar from trezorlib.tools import parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 @pytest.mark.altcoin @pytest.mark.stellar -class TestMsgStellarSignTransaction(TrezorTest): +class TestMsgStellarSignTransaction: ADDRESS_N = parse_path(stellar.DEFAULT_BIP32_PATH) NETWORK_PASSPHRASE = "Test SDF Network ; September 2015" diff --git a/tests/device_tests/test_msg_tezos_getaddress.py b/tests/device_tests/test_msg_tezos_getaddress.py index 774db5343..fc31e2e54 100644 --- a/tests/device_tests/test_msg_tezos_getaddress.py +++ b/tests/device_tests/test_msg_tezos_getaddress.py @@ -19,13 +19,11 @@ import pytest from trezorlib.tezos import get_address from trezorlib.tools import parse_path -from .common import TrezorTest - @pytest.mark.altcoin @pytest.mark.tezos @pytest.mark.skip_t1 -class TestMsgTezosGetAddress(TrezorTest): +class TestMsgTezosGetAddress: def test_tezos_get_address(self, client): path = parse_path("m/44'/1729'/0'") address = get_address(client, path, show_display=True) diff --git a/tests/device_tests/test_msg_tezos_getpublickey.py b/tests/device_tests/test_msg_tezos_getpublickey.py index c1e799f39..e220dad8e 100644 --- a/tests/device_tests/test_msg_tezos_getpublickey.py +++ b/tests/device_tests/test_msg_tezos_getpublickey.py @@ -19,13 +19,11 @@ import pytest from trezorlib.tezos import get_public_key from trezorlib.tools import parse_path -from .common import TrezorTest - @pytest.mark.altcoin @pytest.mark.tezos @pytest.mark.skip_t1 -class TestMsgTezosGetPublicKey(TrezorTest): +class TestMsgTezosGetPublicKey: def test_tezos_get_public_key(self, client): path = parse_path("m/44'/1729'/0'") pk = get_public_key(client, path) diff --git a/tests/device_tests/test_msg_tezos_sign_tx.py b/tests/device_tests/test_msg_tezos_sign_tx.py index da39f6930..fea95dcda 100644 --- a/tests/device_tests/test_msg_tezos_sign_tx.py +++ b/tests/device_tests/test_msg_tezos_sign_tx.py @@ -20,8 +20,6 @@ from trezorlib import messages, tezos from trezorlib.protobuf import dict_to_proto from trezorlib.tools import parse_path -from .common import TrezorTest - TEZOS_PATH = parse_path("m/44'/1729'/0'") TEZOS_PATH_10 = parse_path("m/44'/1729'/10'") @@ -29,7 +27,7 @@ TEZOS_PATH_10 = parse_path("m/44'/1729'/10'") @pytest.mark.altcoin @pytest.mark.tezos @pytest.mark.skip_t1 -class TestMsgTezosSignTx(TrezorTest): +class TestMsgTezosSignTx: def test_tezos_sign_tx_transaction(self, client): resp = tezos.sign_tx( client, diff --git a/tests/device_tests/test_msg_verifymessage.py b/tests/device_tests/test_msg_verifymessage.py index b6cee91b1..54d04e189 100644 --- a/tests/device_tests/test_msg_verifymessage.py +++ b/tests/device_tests/test_msg_verifymessage.py @@ -20,10 +20,8 @@ import pytest from trezorlib import btc -from .common import TrezorTest - -class TestMsgVerifymessage(TrezorTest): +class TestMsgVerifymessage: def test_message_long(self, client): ret = btc.verify_message( client, diff --git a/tests/device_tests/test_msg_verifymessage_segwit.py b/tests/device_tests/test_msg_verifymessage_segwit.py index 53bec957e..f31ae3d22 100644 --- a/tests/device_tests/test_msg_verifymessage_segwit.py +++ b/tests/device_tests/test_msg_verifymessage_segwit.py @@ -16,10 +16,8 @@ from trezorlib import btc -from .common import TrezorTest - -class TestMsgVerifymessageSegwit(TrezorTest): +class TestMsgVerifymessageSegwit: def test_message_long(self, client): ret = btc.verify_message( client, diff --git a/tests/device_tests/test_msg_verifymessage_segwit_native.py b/tests/device_tests/test_msg_verifymessage_segwit_native.py index 54e1c9387..fa2ffed43 100644 --- a/tests/device_tests/test_msg_verifymessage_segwit_native.py +++ b/tests/device_tests/test_msg_verifymessage_segwit_native.py @@ -16,10 +16,8 @@ from trezorlib import btc -from .common import TrezorTest - -class TestMsgVerifymessageSegwitNative(TrezorTest): +class TestMsgVerifymessageSegwitNative: def test_message_long(self, client): ret = btc.verify_message( client, diff --git a/tests/device_tests/test_msg_wipedevice.py b/tests/device_tests/test_msg_wipedevice.py index aaef4bc0f..21fa74d8d 100644 --- a/tests/device_tests/test_msg_wipedevice.py +++ b/tests/device_tests/test_msg_wipedevice.py @@ -18,10 +18,8 @@ import pytest from trezorlib import device, messages as proto -from .common import TrezorTest - -class TestMsgWipedevice(TrezorTest): +class TestMsgWipedevice: @pytest.mark.setup_client(pin=True, passphrase=True) def test_wipe_device(self, client): features = client.call_raw(proto.Initialize()) diff --git a/tests/device_tests/test_multisig.py b/tests/device_tests/test_multisig.py index 653733164..6cc55183e 100644 --- a/tests/device_tests/test_multisig.py +++ b/tests/device_tests/test_multisig.py @@ -19,7 +19,7 @@ import pytest from trezorlib import btc, ckd_public as bip32, messages as proto from trezorlib.tools import CallException, parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 from .tx_cache import tx_cache TX_API = tx_cache("Bitcoin") @@ -29,7 +29,7 @@ TXHASH_c6091a = bytes.fromhex( ) -class TestMultisig(TrezorTest): +class TestMultisig: def test_2_of_3(self, client): nodes = [ btc.get_public_node(client, parse_path("48'/0'/%d'" % index)).node diff --git a/tests/device_tests/test_multisig_change.py b/tests/device_tests/test_multisig_change.py index 7cafd722a..a150f1af7 100644 --- a/tests/device_tests/test_multisig_change.py +++ b/tests/device_tests/test_multisig_change.py @@ -19,13 +19,13 @@ import pytest from trezorlib import btc, ckd_public as bip32, messages as proto from trezorlib.tools import H_, parse_path -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 from .tx_cache import tx_cache TX_API = tx_cache("Testnet") -class TestMultisigChange(TrezorTest): +class TestMultisigChange: node_ext1 = bip32.deserialize( "tpubDADHV9u9Y6gkggintTdMjJE3be58zKNLhpxBQyuEM6Pwx3sN9JVLmMCMN4DNVwL9AKec27z5TaWcWuHzMXiGAtcra5DjwWbvppGX4gaEGVN" ) diff --git a/tests/device_tests/test_op_return.py b/tests/device_tests/test_op_return.py index 75592b5ee..222081a30 100644 --- a/tests/device_tests/test_op_return.py +++ b/tests/device_tests/test_op_return.py @@ -19,7 +19,6 @@ import pytest from trezorlib import btc, messages as proto from trezorlib.tools import CallException, parse_path -from .common import TrezorTest from .conftest import TREZOR_VERSION from .tx_cache import tx_cache @@ -30,7 +29,7 @@ TXHASH_d5f65e = bytes.fromhex( ) -class TestOpReturn(TrezorTest): +class TestOpReturn: def test_opreturn(self, client): inp1 = proto.TxInputType( address_n=parse_path("44'/0'/0'/0/2"), prev_hash=TXHASH_d5f65e, prev_index=0 diff --git a/tests/device_tests/test_protect_call.py b/tests/device_tests/test_protect_call.py index b6babaa07..7a40642da 100644 --- a/tests/device_tests/test_protect_call.py +++ b/tests/device_tests/test_protect_call.py @@ -21,13 +21,11 @@ import pytest from trezorlib import messages as proto from trezorlib.exceptions import PinException -from .common import TrezorTest - # FIXME TODO Add passphrase tests @pytest.mark.skip_t2 -class TestProtectCall(TrezorTest): +class TestProtectCall: def _some_protected_call(self, client, button, pin, passphrase): # This method perform any call which have protection in the device res = client.ping( @@ -38,52 +36,46 @@ class TestProtectCall(TrezorTest): ) assert res == "random data" - """ - def test_expected_responses(self): - self.setup_mnemonic_pin_passphrase() - + @pytest.mark.setup_client(pin="1234", passphrase=True) + def test_expected_responses(self, client): # This is low-level test of set_expected_responses() # feature of debugging client - with self.client: + with pytest.raises(AssertionError), client: # Scenario 1 - Received unexpected message - self.client.set_expected_responses([]) - with pytest.raises(CallException): - self._some_protected_call(True, True, True) + client.set_expected_responses([]) + self._some_protected_call(client, True, True, True) - with self.client: + with pytest.raises(AssertionError), client: # Scenario 2 - Received other than expected message - self.client.set_expected_responses([proto.Success()]) - with pytest.raises(CallException): - self._some_protected_call(True, True, True) - - def scenario3(): - with self.client: - # Scenario 3 - Not received expected message - self.client.set_expected_responses([proto.ButtonRequest(), - proto.Success(), - proto.Success()]) # This is expected, but not received - self._some_protected_call(True, False, False) - with pytest.raises(Exception): - scenario3() - - with self.client: + client.set_expected_responses([proto.Success()]) + self._some_protected_call(client, True, True, True) + + with pytest.raises(AssertionError), client: + # Scenario 3 - Not received expected message + client.set_expected_responses( + [proto.ButtonRequest(), proto.Success(), proto.Success()] + ) # This is expected, but not received + self._some_protected_call(client, True, False, False) + + with pytest.raises(AssertionError), client: # Scenario 4 - Received what expected - self.client.set_expected_responses([proto.ButtonRequest(), - proto.PinMatrixRequest(), - proto.PassphraseRequest(), - proto.Success(message='random data')]) - self._some_protected_call(True, True, True) - - def scenario5(): - with self.client: - # Scenario 5 - Failed message by field filter - self.client.set_expected_responses([proto.ButtonRequest(), - proto.Success(message='wrong data')]) - self._some_protected_call(True, True, True) - with pytest.raises(CallException): - scenario5() - """ + client.set_expected_responses( + [ + proto.ButtonRequest(), + proto.PinMatrixRequest(), + proto.PassphraseRequest(), + proto.Success(message="random data"), + ] + ) + self._some_protected_call(client, True, True, True) + + with pytest.raises(AssertionError), client: + # Scenario 5 - Failed message by field filter + client.set_expected_responses( + [proto.ButtonRequest(), proto.Success(message="wrong data")] + ) + self._some_protected_call(client, True, True, True) def test_no_protection(self, client): with client: diff --git a/tests/device_tests/test_protection_levels.py b/tests/device_tests/test_protection_levels.py index e76c13d00..e9c543d1a 100644 --- a/tests/device_tests/test_protection_levels.py +++ b/tests/device_tests/test_protection_levels.py @@ -19,7 +19,7 @@ import pytest from trezorlib import btc, debuglink, device, messages as proto, misc from trezorlib.exceptions import TrezorFailure -from .common import TrezorTest +from .common import MNEMONIC12 from .tx_cache import tx_cache TXHASH_d5f65e = bytes.fromhex( @@ -28,7 +28,7 @@ TXHASH_d5f65e = bytes.fromhex( @pytest.mark.skip_t2 -class TestProtectionLevels(TrezorTest): +class TestProtectionLevels: @pytest.mark.setup_client(pin=True, passphrase=True) def test_initialize(self, client): with client: @@ -163,7 +163,7 @@ class TestProtectionLevels(TrezorTest): @pytest.mark.setup_client(uninitialized=True) def test_recovery_device(self, client): - client.set_mnemonic(self.mnemonic12) + client.set_mnemonic(MNEMONIC12) with client: client.set_expected_responses( [proto.ButtonRequest()] diff --git a/tests/device_tests/test_zerosig.py b/tests/device_tests/test_zerosig.py index c3afed0d0..a566a95ba 100644 --- a/tests/device_tests/test_zerosig.py +++ b/tests/device_tests/test_zerosig.py @@ -18,7 +18,7 @@ import pytest from trezorlib import btc, messages as proto -from .common import MNEMONIC12, TrezorTest +from .common import MNEMONIC12 from .tx_cache import tx_cache TXHASH_d5f65e = bytes.fromhex( @@ -28,39 +28,7 @@ TXHASH_d5f65e = bytes.fromhex( # address_n = [177] < 68 # address_n = [16518] < 66 -class TestZerosig(TrezorTest): - - """ - def test_mine_zero_signature(self): - # tx: d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882 - # input 0: 0.0039 BTC - - inp1 = proto.TxInputType(address_n=[0], # 14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e - # amount=390000, - prev_hash=TXHASH_d5f65e, - prev_index=0, - ) - - msg = self.client._prepare_sign_tx('Bitcoin', [inp1, ], []) - - for n in range(3500, 200000): - out1 = proto.TxOutputType(address_n=[n], - amount=390000 - 10000, - script_type=proto.OutputScriptType.PAYTOADDRESS, - ) - msg.ClearField('outputs') - msg.outputs.extend([out1, ]) - - tx = self.client.call(msg) - - siglen = tx.serialized_tx[44] - print(siglen) - if siglen < 67: - print("!!!!", n) - print(tx.serialized_tx.hex()) - return - """ - +class TestZerosig: @pytest.mark.setup_client(mnemonic=MNEMONIC12) def test_one_zero_signature(self, client): inp1 = proto.TxInputType(