From e9555a3b0a8d43087bf61d268f9ef24916fd2efe Mon Sep 17 00:00:00 2001 From: matejcik Date: Fri, 22 May 2020 12:22:06 +0200 Subject: [PATCH] tests: rename test_address to get_test_address so that pytest doesn't think it is a testcase --- tests/common.py | 4 +++- tests/device_tests/test_msg_loaddevice.py | 14 +++++++------- .../test_passphrase_slip39_advanced.py | 10 +++++----- tests/device_tests/test_passphrase_slip39_basic.py | 6 +++--- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/tests/common.py b/tests/common.py index 4bfd538ac..30eddea98 100644 --- a/tests/common.py +++ b/tests/common.py @@ -169,5 +169,7 @@ def read_and_confirm_mnemonic(debug, words): return " ".join(mnemonic) -def test_address(client): +def get_test_address(client): + """Fetch a testnet address on a fixed path. Useful to make a pin/passphrase + protected call, or to identify the root secret (seed+passphrase)""" return btc.get_address(client, "Testnet", TEST_ADDRESS_N) diff --git a/tests/device_tests/test_msg_loaddevice.py b/tests/device_tests/test_msg_loaddevice.py index 0b48ea46f..b8fa842f2 100644 --- a/tests/device_tests/test_msg_loaddevice.py +++ b/tests/device_tests/test_msg_loaddevice.py @@ -23,7 +23,7 @@ from ..common import ( MNEMONIC12, MNEMONIC_SLIP39_ADVANCED_20, MNEMONIC_SLIP39_BASIC_20_3of6, - test_address, + get_test_address, ) @@ -42,7 +42,7 @@ class TestDeviceLoad: assert state.pin is None assert state.passphrase_protection is False - address = test_address(client) + address = get_test_address(client) assert address == "mkqRFzxmkCGX9jxgpqqFHcxRUmLJcLDBer" def test_load_device_2(self, client): @@ -62,7 +62,7 @@ class TestDeviceLoad: assert state.pin == "1234" assert state.passphrase_protection is True - address = test_address(client) + address = get_test_address(client) assert address == "mx77VZjTVixVsU7nCtAKHnGFdsyNCnsWWw" @pytest.mark.skip_t1 @@ -116,7 +116,7 @@ class TestDeviceLoad: skip_checksum=True, ) client.use_passphrase(passphrase_nfkd) - address_nfkd = test_address(client) + address_nfkd = get_test_address(client) device.wipe(client) debuglink.load_device( @@ -129,7 +129,7 @@ class TestDeviceLoad: skip_checksum=True, ) client.use_passphrase(passphrase_nfc) - address_nfc = test_address(client) + address_nfc = get_test_address(client) device.wipe(client) debuglink.load_device( @@ -142,7 +142,7 @@ class TestDeviceLoad: skip_checksum=True, ) client.use_passphrase(passphrase_nfkc) - address_nfkc = test_address(client) + address_nfkc = get_test_address(client) device.wipe(client) debuglink.load_device( @@ -155,7 +155,7 @@ class TestDeviceLoad: skip_checksum=True, ) client.use_passphrase(passphrase_nfd) - address_nfd = test_address(client) + address_nfd = get_test_address(client) assert address_nfkd == address_nfc assert address_nfkd == address_nfkc diff --git a/tests/device_tests/test_passphrase_slip39_advanced.py b/tests/device_tests/test_passphrase_slip39_advanced.py index 019633b3f..47c40f6a9 100644 --- a/tests/device_tests/test_passphrase_slip39_advanced.py +++ b/tests/device_tests/test_passphrase_slip39_advanced.py @@ -19,7 +19,7 @@ import pytest from ..common import ( MNEMONIC_SLIP39_ADVANCED_20, MNEMONIC_SLIP39_ADVANCED_33, - test_address, + get_test_address, ) @@ -33,12 +33,12 @@ def test_128bit_passphrase(client): """ assert client.features.passphrase_protection is True client.use_passphrase("TREZOR") - address = test_address(client) + address = get_test_address(client) assert address == "mkKDUMRR1CcK8eLAzCZAjKnNbCquPoWPxN" client.state = None client.clear_session() client.use_passphrase("ROZERT") - address_compare = test_address(client) + address_compare = get_test_address(client) assert address != address_compare @@ -52,10 +52,10 @@ def test_256bit_passphrase(client): """ assert client.features.passphrase_protection is True client.use_passphrase("TREZOR") - address = test_address(client) + address = get_test_address(client) assert address == "mxVtGxUJ898WLzPMmy6PT1FDHD1GUCWGm7" client.state = None client.clear_session() client.use_passphrase("ROZERT") - address_compare = test_address(client) + address_compare = get_test_address(client) assert address != address_compare diff --git a/tests/device_tests/test_passphrase_slip39_basic.py b/tests/device_tests/test_passphrase_slip39_basic.py index 99d1204c2..de41eeb0c 100644 --- a/tests/device_tests/test_passphrase_slip39_basic.py +++ b/tests/device_tests/test_passphrase_slip39_basic.py @@ -16,7 +16,7 @@ import pytest -from ..common import MNEMONIC_SLIP39_BASIC_20_3of6, test_address +from ..common import MNEMONIC_SLIP39_BASIC_20_3of6, get_test_address @pytest.mark.setup_client(mnemonic=MNEMONIC_SLIP39_BASIC_20_3of6, passphrase=True) @@ -29,7 +29,7 @@ def test_3of6_passphrase(client): """ assert client.features.passphrase_protection is True client.use_passphrase("TREZOR") - address = test_address(client) + address = get_test_address(client) assert address == "mi4HXfRJAqCDyEdet5veunBvXLTKSxpuim" @@ -49,5 +49,5 @@ def test_2of5_passphrase(client): """ assert client.features.passphrase_protection is True client.use_passphrase("TREZOR") - address = test_address(client) + address = get_test_address(client) assert address == "mjXH4pN7TtbHp3tWLqVKktKuaQeByHMoBZ"