mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-03 11:20:59 +00:00
tests: enable auto-lock tests for TT
This commit is contained in:
parent
42e7c43c7c
commit
a11ec58eb6
@ -18,7 +18,9 @@ import time
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from trezorlib import btc, device, messages as proto
|
from trezorlib import device, messages as proto
|
||||||
|
|
||||||
|
from ..common import test_address
|
||||||
|
|
||||||
EXPECTED_RESPONSES_NOPIN = [proto.ButtonRequest(), proto.Success(), proto.Features()]
|
EXPECTED_RESPONSES_NOPIN = [proto.ButtonRequest(), proto.Success(), proto.Features()]
|
||||||
EXPECTED_RESPONSES_PIN_T1 = [proto.PinMatrixRequest()] + EXPECTED_RESPONSES_NOPIN
|
EXPECTED_RESPONSES_PIN_T1 = [proto.PinMatrixRequest()] + EXPECTED_RESPONSES_NOPIN
|
||||||
@ -120,8 +122,12 @@ class TestMsgApplysettings:
|
|||||||
_set_expected_responses(client)
|
_set_expected_responses(client)
|
||||||
device.apply_settings(client, homescreen=img)
|
device.apply_settings(client, homescreen=img)
|
||||||
|
|
||||||
@pytest.mark.skip_t2
|
|
||||||
def test_apply_auto_lock_delay(self, client):
|
def test_apply_auto_lock_delay(self, client):
|
||||||
|
pin_response = (
|
||||||
|
proto.PinMatrixRequest()
|
||||||
|
if client.features.model == "1"
|
||||||
|
else proto.ButtonRequest()
|
||||||
|
)
|
||||||
with client:
|
with client:
|
||||||
_set_expected_responses(client)
|
_set_expected_responses(client)
|
||||||
device.apply_settings(client, auto_lock_delay_ms=int(10e3)) # 10 secs
|
device.apply_settings(client, auto_lock_delay_ms=int(10e3)) # 10 secs
|
||||||
@ -130,20 +136,24 @@ class TestMsgApplysettings:
|
|||||||
with client:
|
with client:
|
||||||
# No PIN protection is required.
|
# No PIN protection is required.
|
||||||
client.set_expected_responses([proto.Address()])
|
client.set_expected_responses([proto.Address()])
|
||||||
btc.get_address(client, "Testnet", [0])
|
test_address(client)
|
||||||
|
|
||||||
time.sleep(10.1) # sleep more than auto-lock delay
|
time.sleep(10.1) # sleep more than auto-lock delay
|
||||||
with client:
|
with client:
|
||||||
client.use_pin_sequence([PIN4])
|
client.use_pin_sequence([PIN4])
|
||||||
client.set_expected_responses([proto.PinMatrixRequest(), proto.Address()])
|
client.set_expected_responses([pin_response, proto.Address()])
|
||||||
btc.get_address(client, "Testnet", [0])
|
test_address(client)
|
||||||
|
|
||||||
@pytest.mark.skip_t2
|
|
||||||
def test_apply_minimal_auto_lock_delay(self, client):
|
def test_apply_minimal_auto_lock_delay(self, client):
|
||||||
"""
|
"""
|
||||||
Verify that the delay is not below the minimal auto-lock delay (10 secs)
|
Verify that the delay is not below the minimal auto-lock delay (10 secs)
|
||||||
otherwise the device may auto-lock before any user interaction.
|
otherwise the device may auto-lock before any user interaction.
|
||||||
"""
|
"""
|
||||||
|
pin_response = (
|
||||||
|
proto.PinMatrixRequest()
|
||||||
|
if client.features.model == "1"
|
||||||
|
else proto.ButtonRequest()
|
||||||
|
)
|
||||||
|
|
||||||
with client:
|
with client:
|
||||||
_set_expected_responses(client)
|
_set_expected_responses(client)
|
||||||
@ -154,16 +164,16 @@ class TestMsgApplysettings:
|
|||||||
with client:
|
with client:
|
||||||
# No PIN protection is required.
|
# No PIN protection is required.
|
||||||
client.set_expected_responses([proto.Address()])
|
client.set_expected_responses([proto.Address()])
|
||||||
btc.get_address(client, "Testnet", [0])
|
test_address(client)
|
||||||
|
|
||||||
time.sleep(2) # sleep less than the minimal auto-lock delay
|
time.sleep(2) # sleep less than the minimal auto-lock delay
|
||||||
with client:
|
with client:
|
||||||
# No PIN protection is required.
|
# No PIN protection is required.
|
||||||
client.set_expected_responses([proto.Address()])
|
client.set_expected_responses([proto.Address()])
|
||||||
btc.get_address(client, "Testnet", [0])
|
test_address(client)
|
||||||
|
|
||||||
time.sleep(10.1) # sleep more than the minimal auto-lock delay
|
time.sleep(10.1) # sleep more than the minimal auto-lock delay
|
||||||
with client:
|
with client:
|
||||||
client.use_pin_sequence([PIN4])
|
client.use_pin_sequence([PIN4])
|
||||||
client.set_expected_responses([proto.PinMatrixRequest(), proto.Address()])
|
client.set_expected_responses([pin_response, proto.Address()])
|
||||||
btc.get_address(client, "Testnet", [0])
|
test_address(client)
|
||||||
|
Loading…
Reference in New Issue
Block a user