1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-25 07:48:10 +00:00

tests: rename test_address to get_test_address

so that pytest doesn't think it is a testcase
This commit is contained in:
matejcik 2020-05-22 12:22:06 +02:00 committed by matejcik
parent 3dbd9c9eca
commit e9555a3b0a
4 changed files with 18 additions and 16 deletions

View File

@ -169,5 +169,7 @@ def read_and_confirm_mnemonic(debug, words):
return " ".join(mnemonic) 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) return btc.get_address(client, "Testnet", TEST_ADDRESS_N)

View File

@ -23,7 +23,7 @@ from ..common import (
MNEMONIC12, MNEMONIC12,
MNEMONIC_SLIP39_ADVANCED_20, MNEMONIC_SLIP39_ADVANCED_20,
MNEMONIC_SLIP39_BASIC_20_3of6, MNEMONIC_SLIP39_BASIC_20_3of6,
test_address, get_test_address,
) )
@ -42,7 +42,7 @@ class TestDeviceLoad:
assert state.pin is None assert state.pin is None
assert state.passphrase_protection is False assert state.passphrase_protection is False
address = test_address(client) address = get_test_address(client)
assert address == "mkqRFzxmkCGX9jxgpqqFHcxRUmLJcLDBer" assert address == "mkqRFzxmkCGX9jxgpqqFHcxRUmLJcLDBer"
def test_load_device_2(self, client): def test_load_device_2(self, client):
@ -62,7 +62,7 @@ class TestDeviceLoad:
assert state.pin == "1234" assert state.pin == "1234"
assert state.passphrase_protection is True assert state.passphrase_protection is True
address = test_address(client) address = get_test_address(client)
assert address == "mx77VZjTVixVsU7nCtAKHnGFdsyNCnsWWw" assert address == "mx77VZjTVixVsU7nCtAKHnGFdsyNCnsWWw"
@pytest.mark.skip_t1 @pytest.mark.skip_t1
@ -116,7 +116,7 @@ class TestDeviceLoad:
skip_checksum=True, skip_checksum=True,
) )
client.use_passphrase(passphrase_nfkd) client.use_passphrase(passphrase_nfkd)
address_nfkd = test_address(client) address_nfkd = get_test_address(client)
device.wipe(client) device.wipe(client)
debuglink.load_device( debuglink.load_device(
@ -129,7 +129,7 @@ class TestDeviceLoad:
skip_checksum=True, skip_checksum=True,
) )
client.use_passphrase(passphrase_nfc) client.use_passphrase(passphrase_nfc)
address_nfc = test_address(client) address_nfc = get_test_address(client)
device.wipe(client) device.wipe(client)
debuglink.load_device( debuglink.load_device(
@ -142,7 +142,7 @@ class TestDeviceLoad:
skip_checksum=True, skip_checksum=True,
) )
client.use_passphrase(passphrase_nfkc) client.use_passphrase(passphrase_nfkc)
address_nfkc = test_address(client) address_nfkc = get_test_address(client)
device.wipe(client) device.wipe(client)
debuglink.load_device( debuglink.load_device(
@ -155,7 +155,7 @@ class TestDeviceLoad:
skip_checksum=True, skip_checksum=True,
) )
client.use_passphrase(passphrase_nfd) 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_nfc
assert address_nfkd == address_nfkc assert address_nfkd == address_nfkc

View File

@ -19,7 +19,7 @@ import pytest
from ..common import ( from ..common import (
MNEMONIC_SLIP39_ADVANCED_20, MNEMONIC_SLIP39_ADVANCED_20,
MNEMONIC_SLIP39_ADVANCED_33, 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 assert client.features.passphrase_protection is True
client.use_passphrase("TREZOR") client.use_passphrase("TREZOR")
address = test_address(client) address = get_test_address(client)
assert address == "mkKDUMRR1CcK8eLAzCZAjKnNbCquPoWPxN" assert address == "mkKDUMRR1CcK8eLAzCZAjKnNbCquPoWPxN"
client.state = None client.state = None
client.clear_session() client.clear_session()
client.use_passphrase("ROZERT") client.use_passphrase("ROZERT")
address_compare = test_address(client) address_compare = get_test_address(client)
assert address != address_compare assert address != address_compare
@ -52,10 +52,10 @@ def test_256bit_passphrase(client):
""" """
assert client.features.passphrase_protection is True assert client.features.passphrase_protection is True
client.use_passphrase("TREZOR") client.use_passphrase("TREZOR")
address = test_address(client) address = get_test_address(client)
assert address == "mxVtGxUJ898WLzPMmy6PT1FDHD1GUCWGm7" assert address == "mxVtGxUJ898WLzPMmy6PT1FDHD1GUCWGm7"
client.state = None client.state = None
client.clear_session() client.clear_session()
client.use_passphrase("ROZERT") client.use_passphrase("ROZERT")
address_compare = test_address(client) address_compare = get_test_address(client)
assert address != address_compare assert address != address_compare

View File

@ -16,7 +16,7 @@
import pytest 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) @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 assert client.features.passphrase_protection is True
client.use_passphrase("TREZOR") client.use_passphrase("TREZOR")
address = test_address(client) address = get_test_address(client)
assert address == "mi4HXfRJAqCDyEdet5veunBvXLTKSxpuim" assert address == "mi4HXfRJAqCDyEdet5veunBvXLTKSxpuim"
@ -49,5 +49,5 @@ def test_2of5_passphrase(client):
""" """
assert client.features.passphrase_protection is True assert client.features.passphrase_protection is True
client.use_passphrase("TREZOR") client.use_passphrase("TREZOR")
address = test_address(client) address = get_test_address(client)
assert address == "mjXH4pN7TtbHp3tWLqVKktKuaQeByHMoBZ" assert address == "mjXH4pN7TtbHp3tWLqVKktKuaQeByHMoBZ"