1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-27 07:40:59 +00:00

tests: unify Ping replacements

for raw calls: just messages.GetAddress()
for library calls: btc.get_address(client, "Testnet", [0])
This commit is contained in:
matejcik 2020-01-31 16:58:01 +01:00 committed by Pavol Rusnak
parent a8cfa8fbed
commit 9c75e27433
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
4 changed files with 11 additions and 13 deletions

View File

@ -34,7 +34,7 @@ class TestDebuglink:
@pytest.mark.setup_client(mnemonic=MNEMONIC12, pin="1234", passphrase=True)
def test_pin(self, client):
resp = client.call_raw(messages.GetAddress(address_n=[], coin_name="Testnet"))
resp = client.call_raw(messages.GetAddress())
assert isinstance(resp, messages.PinMatrixRequest)
pin, matrix = client.debug.read_pin()

View File

@ -85,7 +85,7 @@ class TestMsgRecoverydevice:
assert client.features.passphrase_protection is True
# Do passphrase-protected action, PassphraseRequest should be raised
resp = client.call_raw(proto.GetAddress(address_n=[], coin_name="Testnet"))
resp = client.call_raw(proto.GetAddress())
assert isinstance(resp, proto.PassphraseRequest)
client.call_raw(proto.Cancel())
@ -137,7 +137,7 @@ class TestMsgRecoverydevice:
assert client.features.passphrase_protection is False
# Do pin & passphrase-protected action, PassphraseRequest should NOT be raised
resp = client.call_raw(proto.GetAddress(address_n=[], coin_name="Testnet"))
resp = client.call_raw(proto.GetAddress())
assert isinstance(resp, proto.Address)
@pytest.mark.setup_client(uninitialized=True)

View File

@ -88,7 +88,7 @@ class TestMsgResetDevice:
assert resp.passphrase_protection is False
# Do pin & passphrase-protected action, PassphraseRequest should NOT be raised
resp = client.call_raw(proto.GetAddress(address_n=[], coin_name="Testnet"))
resp = client.call_raw(proto.GetAddress())
assert isinstance(resp, proto.Address)
@pytest.mark.setup_client(uninitialized=True)
@ -176,7 +176,7 @@ class TestMsgResetDevice:
assert resp.passphrase_protection is True
# Do passphrase-protected action, PassphraseRequest should be raised
resp = client.call_raw(proto.GetAddress(address_n=[], coin_name="Testnet"))
resp = client.call_raw(proto.GetAddress())
assert isinstance(resp, proto.PassphraseRequest)
client.call_raw(proto.Cancel())

View File

@ -261,23 +261,21 @@ class TestProtectionLevels:
assert client.features.pin_cached is False
with client:
client.set_expected_responses(
[proto.PinMatrixRequest(), proto.ButtonRequest(), proto.Address()]
)
btc.get_address(client, "Bitcoin", [], show_display=True)
client.set_expected_responses([proto.PinMatrixRequest(), proto.Address()])
btc.get_address(client, "Testnet", [0])
client.init_device()
assert client.features.pin_cached is True
with client:
client.set_expected_responses([proto.ButtonRequest(), proto.Address()])
btc.get_address(client, "Bitcoin", [], show_display=True)
client.set_expected_responses([proto.Address()])
btc.get_address(client, "Testnet", [0])
@pytest.mark.setup_client(passphrase=True)
def test_passphrase_cached(self, client):
with client:
client.set_expected_responses([proto.PassphraseRequest(), proto.Address()])
btc.get_address(client, "Bitcoin", [])
btc.get_address(client, "Testnet", [0])
with client:
client.set_expected_responses([proto.Address()])
btc.get_address(client, "Bitcoin", [])
btc.get_address(client, "Testnet", [0])