mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-04-13 13:55:50 +00:00
tests: add UI test for multisig+xpub feature
This commit is contained in:
parent
b9486c0b33
commit
d98bbebf5e
@ -16,7 +16,7 @@
|
||||
|
||||
import pytest
|
||||
|
||||
from trezorlib import btc, ckd_public as bip32, messages as proto
|
||||
from trezorlib import btc, ckd_public as bip32, messages, tools
|
||||
|
||||
from ..common import MNEMONIC12
|
||||
|
||||
@ -43,11 +43,11 @@ class TestMsgGetaddressShow:
|
||||
node = bip32.deserialize(
|
||||
"xpub661MyMwAqRbcF1zGijBb2K6x9YiJPh58xpcCeLvTxMX6spkY3PcpJ4ABcCyWfskq5DDxM3e6Ez5ePCqG5bnPUXR4wL8TZWyoDaUdiWW7bKy"
|
||||
)
|
||||
multisig = proto.MultisigRedeemScriptType(
|
||||
multisig = messages.MultisigRedeemScriptType(
|
||||
pubkeys=[
|
||||
proto.HDNodePathType(node=node, address_n=[1]),
|
||||
proto.HDNodePathType(node=node, address_n=[2]),
|
||||
proto.HDNodePathType(node=node, address_n=[3]),
|
||||
messages.HDNodePathType(node=node, address_n=[1]),
|
||||
messages.HDNodePathType(node=node, address_n=[2]),
|
||||
messages.HDNodePathType(node=node, address_n=[3]),
|
||||
],
|
||||
signatures=[b"", b"", b""],
|
||||
m=2,
|
||||
@ -61,6 +61,75 @@ class TestMsgGetaddressShow:
|
||||
== "3E7GDtuHqnqPmDgwH59pVC7AvySiSkbibz"
|
||||
)
|
||||
|
||||
@pytest.mark.skip_t1
|
||||
@pytest.mark.multisig
|
||||
def test_show_multisig_xpubs(self, client):
|
||||
nodes = [
|
||||
btc.get_public_node(
|
||||
client, tools.parse_path(f"48h/0h/{i}h"), coin_name="Bitcoin"
|
||||
)
|
||||
for i in range(3)
|
||||
]
|
||||
multisig = messages.MultisigRedeemScriptType(
|
||||
nodes=[n.node for n in nodes],
|
||||
signatures=[b"", b"", b""],
|
||||
address_n=[0, 0],
|
||||
m=2,
|
||||
)
|
||||
|
||||
xpubs = [[n.xpub[i * 16 : (i + 1) * 16] for i in range(5)] for n in nodes]
|
||||
|
||||
for i in range(3):
|
||||
|
||||
def input_flow():
|
||||
yield # show address
|
||||
assert client.debug.wait_layout().lines == [
|
||||
"Multisig 2 of 3",
|
||||
"34yJV2b2GtbmxfZNw",
|
||||
"jPyuyUYkUbUnogqa8",
|
||||
]
|
||||
|
||||
client.debug.press_no()
|
||||
yield # show QR code
|
||||
assert client.debug.wait_layout().text.startswith("Qr")
|
||||
|
||||
client.debug.press_no()
|
||||
yield # show XPUB#1
|
||||
lines = client.debug.wait_layout().lines
|
||||
assert lines[0] == "XPUB #1 " + ("(yours)" if i == 0 else "(others)")
|
||||
assert lines[1:] == xpubs[0]
|
||||
# just for UI test
|
||||
client.debug.swipe_up()
|
||||
|
||||
client.debug.press_no()
|
||||
yield # show XPUB#2
|
||||
lines = client.debug.wait_layout().lines
|
||||
assert lines[0] == "XPUB #2 " + ("(yours)" if i == 1 else "(others)")
|
||||
assert lines[1:] == xpubs[1]
|
||||
# just for UI test
|
||||
client.debug.swipe_up()
|
||||
|
||||
client.debug.press_no()
|
||||
yield # show XPUB#3
|
||||
lines = client.debug.wait_layout().lines
|
||||
assert lines[0] == "XPUB #3 " + ("(yours)" if i == 2 else "(others)")
|
||||
assert lines[1:] == xpubs[2]
|
||||
# just for UI test
|
||||
client.debug.swipe_up()
|
||||
|
||||
client.debug.press_yes()
|
||||
|
||||
with client:
|
||||
client.set_input_flow(input_flow)
|
||||
btc.get_address(
|
||||
client,
|
||||
"Bitcoin",
|
||||
tools.parse_path(f"48h/0h/{i}h/0/0"),
|
||||
show_display=True,
|
||||
multisig=multisig,
|
||||
script_type=messages.InputScriptType.SPENDMULTISIG,
|
||||
)
|
||||
|
||||
@pytest.mark.multisig
|
||||
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
||||
def test_show_multisig_15(self, client):
|
||||
@ -70,9 +139,9 @@ class TestMsgGetaddressShow:
|
||||
|
||||
pubs = []
|
||||
for x in range(15):
|
||||
pubs.append(proto.HDNodePathType(node=node, address_n=[x]))
|
||||
pubs.append(messages.HDNodePathType(node=node, address_n=[x]))
|
||||
|
||||
multisig = proto.MultisigRedeemScriptType(
|
||||
multisig = messages.MultisigRedeemScriptType(
|
||||
pubkeys=pubs, signatures=[b""] * 15, m=15
|
||||
)
|
||||
|
||||
|
@ -122,6 +122,7 @@
|
||||
"test_msg_getaddress_show.py-test_show": "903c42539d1b09cb75fda744afc9f645daf71fecf6ee993b231837a86172c0b8",
|
||||
"test_msg_getaddress_show.py-test_show_multisig_15": "81fd8fc77f7e48369b528b304db16a11d970dac052b045d9988e5ded580251f4",
|
||||
"test_msg_getaddress_show.py-test_show_multisig_3": "c11622e28edfd26e91be1c4fb67e1301b66ce61d70ec24946d1cb3f78e38377b",
|
||||
"test_msg_getaddress_show.py-test_show_multisig_xpubs": "d89621c445de3ddcd0c922860869dc1edc1f00a3756cacd558b9d0b9cc6782ac",
|
||||
"test_msg_getecdhsessionkey.py-test_ecdh": "75fe462e6afa73742949ede4f3529d2e0ec08f8f1b67c04a57189c8657fcbdcd",
|
||||
"test_msg_getentropy.py::test_entropy[128]": "a722fa2048fa3102889ec05558d25f837a364ef2a118e85975683e10a56f1356",
|
||||
"test_msg_getentropy.py::test_entropy[129]": "a722fa2048fa3102889ec05558d25f837a364ef2a118e85975683e10a56f1356",
|
||||
|
Loading…
Reference in New Issue
Block a user