1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-28 17:18:29 +00:00

chore(tests): more test reorganizations

This commit is contained in:
grdddj 2021-11-29 12:00:01 +01:00 committed by matejcik
parent 18a2642d95
commit 0b0a77703c
68 changed files with 70 additions and 76 deletions

View File

@ -20,8 +20,8 @@ from trezorlib import btc, device, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from .signtx import request_finished, request_input, request_meta, request_output
from ...tx_cache import TxCache
from ..signtx import request_finished, request_input, request_meta, request_output
B = messages.ButtonRequestType

View File

@ -20,8 +20,8 @@ from trezorlib import btc, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import H_, parse_path
from ..tx_cache import TxCache
from .signtx import request_finished, request_input, request_meta, request_output
from ...tx_cache import TxCache
from ..signtx import request_finished, request_input, request_meta, request_output
B = messages.ButtonRequestType
TX_API = TxCache("Bcash")

View File

@ -20,8 +20,8 @@ from trezorlib import btc, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import H_, btc_hash, parse_path
from ..tx_cache import TxCache
from .signtx import request_finished, request_input, request_meta, request_output
from ...tx_cache import TxCache
from ..signtx import request_finished, request_input, request_meta, request_output
B = messages.ButtonRequestType
TX_API = TxCache("Bgold")

View File

@ -19,8 +19,8 @@ import pytest
from trezorlib import btc, messages
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from .signtx import (
from ...tx_cache import TxCache
from ..signtx import (
request_extra_data,
request_finished,
request_input,

View File

@ -19,8 +19,8 @@ import pytest
from trezorlib import btc, messages
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from .signtx import request_finished, request_input, request_meta, request_output
from ...tx_cache import TxCache
from ..signtx import request_finished, request_input, request_meta, request_output
B = messages.ButtonRequestType
TX_API = TxCache("Decred Testnet")

View File

@ -19,7 +19,7 @@ import pytest
from trezorlib import btc, messages
from trezorlib.tools import btc_hash, parse_path
from ..tx_cache import TxCache
from ...tx_cache import TxCache
TX_API = TxCache("Firo Testnet")
TXHASH_8a34cc = bytes.fromhex(

View File

@ -21,7 +21,7 @@ from trezorlib.exceptions import TrezorFailure
from trezorlib.messages import SafetyCheckLevel
from trezorlib.tools import parse_path
from .. import bip32
from ... import bip32
def getmultisig(chain, nr, xpubs):

View File

@ -48,25 +48,25 @@ VECTORS = ( # coin, path, script_type, address
(
"Testnet",
"86'/1'/0'/0/0",
proto.InputScriptType.SPENDTAPROOT,
messages.InputScriptType.SPENDTAPROOT,
"tb1pswrqtykue8r89t9u4rprjs0gt4qzkdfuursfnvqaa3f2yql07zmq8s8a5u",
),
(
"Testnet",
"86'/1'/0'/1/0",
proto.InputScriptType.SPENDTAPROOT,
messages.InputScriptType.SPENDTAPROOT,
"tb1pn2d0yjeedavnkd8z8lhm566p0f2utm3lgvxrsdehnl94y34txmts5s7t4c",
),
(
"Bitcoin",
"86'/0'/0'/0/0",
proto.InputScriptType.SPENDTAPROOT,
messages.InputScriptType.SPENDTAPROOT,
"bc1ptxs597p3fnpd8gwut5p467ulsydae3rp9z75hd99w8k3ljr9g9rqx6ynaw",
),
(
"Bitcoin",
"86'/0'/0'/1/0",
proto.InputScriptType.SPENDTAPROOT,
messages.InputScriptType.SPENDTAPROOT,
"bc1pgypgja2hmcx2l6s2ssq75k6ev68ved6nujcspt47dgvkp8euc70s6uegk6",
),
pytest.param(
@ -122,7 +122,7 @@ def test_bip86(client, path, address):
parse_path(path),
False,
None,
script_type=proto.InputScriptType.SPENDTAPROOT,
script_type=messages.InputScriptType.SPENDTAPROOT,
)
== address
)

View File

@ -20,7 +20,7 @@ from trezorlib import btc, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import parse_path
from .. import bip32
from ... import bip32
VECTORS_BITCOIN = ( # coin_name, xpub_magic, path, xpub
(

View File

@ -19,7 +19,7 @@ import pytest
from trezorlib import btc, messages
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from ...tx_cache import TxCache
B = messages.ButtonRequestType
TX_API = TxCache("Groestlcoin")

View File

@ -19,8 +19,8 @@ import pytest
from trezorlib import btc, messages
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from .signtx import (
from ...tx_cache import TxCache
from ..signtx import (
request_extra_data,
request_finished,
request_input,

View File

@ -20,9 +20,9 @@ from trezorlib import btc, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import parse_path, tx_hash
from ..common import MNEMONIC12
from ..tx_cache import TxCache
from .signtx import request_finished, request_input, request_meta, request_output
from ...common import MNEMONIC12
from ...tx_cache import TxCache
from ..signtx import request_finished, request_input, request_meta, request_output
B = messages.ButtonRequestType
TX_API = TxCache("Bitcoin")

View File

@ -19,10 +19,10 @@ import pytest
from trezorlib import btc, messages
from trezorlib.tools import H_, parse_path
from .. import bip32
from ..common import MNEMONIC12
from ..tx_cache import TxCache
from .signtx import request_finished, request_input, request_meta, request_output
from ... import bip32
from ...common import MNEMONIC12
from ...tx_cache import TxCache
from ..signtx import request_finished, request_input, request_meta, request_output
B = messages.ButtonRequestType
TX_API = TxCache("Testnet")
@ -136,6 +136,7 @@ INP3 = messages.TxInputType(
multisig=multisig_in3,
)
def _responses(INP1, INP2, change=0):
resp = [
request_input(0),
@ -219,9 +220,7 @@ def test_external_internal(client):
)
with client:
client.set_expected_responses(
_responses(INP1, INP2, change=2)
)
client.set_expected_responses(_responses(INP1, INP2, change=2))
_, serialized_tx = btc.sign_tx(
client,
"Bitcoin",
@ -251,9 +250,7 @@ def test_internal_external(client):
)
with client:
client.set_expected_responses(
_responses(INP1, INP2, change=1)
)
client.set_expected_responses(_responses(INP1, INP2, change=1))
_, serialized_tx = btc.sign_tx(
client,
"Bitcoin",
@ -321,9 +318,7 @@ def test_multisig_change_match_first(client):
)
with client:
client.set_expected_responses(
_responses(INP1, INP2, change=1)
)
client.set_expected_responses(_responses(INP1, INP2, change=1))
_, serialized_tx = btc.sign_tx(
client,
"Bitcoin",
@ -361,9 +356,7 @@ def test_multisig_change_match_second(client):
)
with client:
client.set_expected_responses(
_responses(INP1, INP2, change=2)
)
client.set_expected_responses(_responses(INP1, INP2, change=2))
_, serialized_tx = btc.sign_tx(
client,
"Bitcoin",

View File

@ -19,7 +19,7 @@ import pytest
from trezorlib import btc, messages
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from ...tx_cache import TxCache
TX_CACHE_MAINNET = TxCache("Bitcoin")

View File

@ -20,8 +20,8 @@ from trezorlib import btc, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from .signtx import request_finished, request_input, request_meta, request_output
from ...tx_cache import TxCache
from ..signtx import request_finished, request_input, request_meta, request_output
B = messages.ButtonRequestType
TX_API = TxCache("Bitcoin")

View File

@ -20,7 +20,7 @@ from trezorlib import btc, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from ...tx_cache import TxCache
TX_CACHE = TxCache("Peercoin")

View File

@ -22,9 +22,9 @@ from trezorlib import btc, device, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import H_, parse_path, tx_hash
from ..common import MNEMONIC12
from ..tx_cache import TxCache
from .signtx import request_finished, request_input, request_meta, request_output
from ...common import MNEMONIC12
from ...tx_cache import TxCache
from ..signtx import request_finished, request_input, request_meta, request_output
B = messages.ButtonRequestType

View File

@ -19,7 +19,7 @@ import pytest
from trezorlib import btc, messages
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from ...tx_cache import TxCache
TX_API = TxCache("Testnet")

View File

@ -20,8 +20,8 @@ from trezorlib import btc, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from .signtx import request_finished, request_input, request_meta, request_output
from ...tx_cache import TxCache
from ..signtx import request_finished, request_input, request_meta, request_output
B = messages.ButtonRequestType

View File

@ -20,7 +20,7 @@ from trezorlib import btc, device, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from ...tx_cache import TxCache
TX_CACHE_MAINNET = TxCache("Bitcoin")
TX_CACHE_BCASH = TxCache("Bcash")
@ -34,6 +34,7 @@ TXHASH_d5f65e = bytes.fromhex(
pytestmark = pytest.mark.altcoin
# Adapted from TestMsgSigntx.test_one_one_fee,
# only changed the coin from Bitcoin to Litecoin.
# Litecoin does not have strong replay protection using SIGHASH_FORKID,

View File

@ -17,7 +17,7 @@
from trezorlib import btc, messages
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from ...tx_cache import TxCache
TX_API = TxCache("Testnet")

View File

@ -6,7 +6,7 @@ import pytest
from trezorlib import btc, messages, tools
from trezorlib.exceptions import TrezorFailure
from ..tx_cache import TxCache
from ...tx_cache import TxCache
TXHASH_157041 = bytes.fromhex(
"1570416eb4302cf52979afd5e6909e37d8fdd874301f7cc87e547e509cb1caa6"

View File

@ -20,8 +20,8 @@ from trezorlib import btc, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from .signtx import (
from ...tx_cache import TxCache
from ..signtx import (
request_finished,
request_input,
request_meta,

View File

@ -20,8 +20,8 @@ from trezorlib import btc, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import H_, parse_path
from ..tx_cache import TxCache
from .signtx import request_finished, request_input, request_meta, request_output
from ...tx_cache import TxCache
from ..signtx import request_finished, request_input, request_meta, request_output
B = messages.ButtonRequestType
TX_API = TxCache("Testnet")

View File

@ -19,9 +19,9 @@ import pytest
from trezorlib import btc, messages
from trezorlib.tools import H_, parse_path
from ..bip32 import deserialize
from ..tx_cache import TxCache
from .signtx import request_finished, request_input, request_meta, request_output
from ...bip32 import deserialize
from ...tx_cache import TxCache
from ..signtx import request_finished, request_input, request_meta, request_output
B = messages.ButtonRequestType
TX_API = TxCache("Testnet")

View File

@ -20,8 +20,8 @@ from trezorlib import btc, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import H_, parse_path
from ..tx_cache import TxCache
from .signtx import request_finished, request_input, request_meta, request_output
from ...tx_cache import TxCache
from ..signtx import request_finished, request_input, request_meta, request_output
B = messages.ButtonRequestType
TX_API = TxCache("Testnet")

View File

@ -20,8 +20,8 @@ from trezorlib import btc, messages
from trezorlib.exceptions import TrezorFailure
from trezorlib.tools import parse_path
from ..tx_cache import TxCache
from .signtx import (
from ...tx_cache import TxCache
from ..signtx import (
request_extra_data,
request_finished,
request_input,

View File

@ -18,7 +18,7 @@ import pytest
from trezorlib import misc
from ..common import MNEMONIC12
from ...common import MNEMONIC12
@pytest.mark.setup_client(mnemonic=MNEMONIC12)

View File

@ -18,7 +18,7 @@ import pytest
from trezorlib import messages, misc
from ..common import MNEMONIC12
from ...common import MNEMONIC12
@pytest.mark.setup_client(mnemonic=MNEMONIC12)

View File

@ -18,7 +18,7 @@ import pytest
from trezorlib import messages, misc
from ..common import MNEMONIC12
from ...common import MNEMONIC12
@pytest.mark.setup_client(mnemonic=MNEMONIC12)

View File

@ -23,7 +23,7 @@ from ...common import MNEMONIC12
PIN4 = "1234"
PIN6 = "789456"
pytestmark = [pytest.mark.skip_t2]
pytestmark = pytest.mark.skip_t2
@pytest.mark.setup_client(uninitialized=True)

View File

@ -23,7 +23,7 @@ from shamir_mnemonic import shamir
from trezorlib import device, messages
from trezorlib.messages import BackupType, ButtonRequestType as B
from ..common import EXTERNAL_ENTROPY, click_through, read_and_confirm_mnemonic
from ...common import EXTERNAL_ENTROPY, click_through, read_and_confirm_mnemonic
def backup_flow_bip39(client):

View File

@ -21,7 +21,7 @@ from trezorlib import messages
from ...common import generate_entropy
pytestmark = [pytest.mark.skip_t2]
pytestmark = pytest.mark.skip_t2
EXTERNAL_ENTROPY = b"zlutoucky kun upel divoke ody" * 2
STRENGTH = 128

View File

@ -21,7 +21,7 @@ from trezorlib import device, messages
from ...common import generate_entropy
pytestmark = [pytest.mark.skip_t1]
pytestmark = pytest.mark.skip_t2
def reset_device(client, strength):

View File

@ -23,7 +23,7 @@ from trezorlib import btc, device, messages
from trezorlib.messages import BackupType, ButtonRequestType as B
from trezorlib.tools import parse_path
from ..common import EXTERNAL_ENTROPY, click_through, read_and_confirm_mnemonic
from ...common import EXTERNAL_ENTROPY, click_through, read_and_confirm_mnemonic
@pytest.mark.skip_t1

View File

@ -22,7 +22,7 @@ from trezorlib import btc, device, messages
from trezorlib.messages import BackupType, ButtonRequestType as B
from trezorlib.tools import parse_path
from ..common import (
from ...common import (
EXTERNAL_ENTROPY,
click_through,
read_and_confirm_mnemonic,

View File

@ -23,7 +23,7 @@ from trezorlib import btc, device, messages
from trezorlib.messages import BackupType, ButtonRequestType as B
from trezorlib.tools import parse_path
from ..common import click_through, read_and_confirm_mnemonic, recovery_enter_shares
from ...common import click_through, read_and_confirm_mnemonic, recovery_enter_shares
EXTERNAL_ENTROPY = b"zlutoucky kun upel divoke ody" * 2
MOCK_OS_URANDOM = mock.Mock(return_value=EXTERNAL_ENTROPY)

View File

View File

@ -57,7 +57,7 @@ import pytest
from trezorlib import messages, protobuf, stellar
from trezorlib.tools import parse_path
from ..common import parametrize_using_common_fixtures
from ...common import parametrize_using_common_fixtures
def parameters_to_proto(parameters):

View File

View File

@ -19,7 +19,7 @@ import pytest
from trezorlib import fido
from trezorlib.exceptions import Cancelled, TrezorFailure
from ..common import MNEMONIC12
from ...common import MNEMONIC12
from .data_webauthn import CRED1, CRED2, CRED3, CREDS
RK_CAPACITY = 100