mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-17 21:22:10 +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
|
||||
|
||||
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_PIN_T1 = [proto.PinMatrixRequest()] + EXPECTED_RESPONSES_NOPIN
|
||||
@ -120,8 +122,12 @@ class TestMsgApplysettings:
|
||||
_set_expected_responses(client)
|
||||
device.apply_settings(client, homescreen=img)
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
def test_apply_auto_lock_delay(self, client):
|
||||
pin_response = (
|
||||
proto.PinMatrixRequest()
|
||||
if client.features.model == "1"
|
||||
else proto.ButtonRequest()
|
||||
)
|
||||
with client:
|
||||
_set_expected_responses(client)
|
||||
device.apply_settings(client, auto_lock_delay_ms=int(10e3)) # 10 secs
|
||||
@ -130,20 +136,24 @@ class TestMsgApplysettings:
|
||||
with client:
|
||||
# No PIN protection is required.
|
||||
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
|
||||
with client:
|
||||
client.use_pin_sequence([PIN4])
|
||||
client.set_expected_responses([proto.PinMatrixRequest(), proto.Address()])
|
||||
btc.get_address(client, "Testnet", [0])
|
||||
client.set_expected_responses([pin_response, proto.Address()])
|
||||
test_address(client)
|
||||
|
||||
@pytest.mark.skip_t2
|
||||
def test_apply_minimal_auto_lock_delay(self, client):
|
||||
"""
|
||||
Verify that the delay is not below the minimal auto-lock delay (10 secs)
|
||||
otherwise the device may auto-lock before any user interaction.
|
||||
"""
|
||||
pin_response = (
|
||||
proto.PinMatrixRequest()
|
||||
if client.features.model == "1"
|
||||
else proto.ButtonRequest()
|
||||
)
|
||||
|
||||
with client:
|
||||
_set_expected_responses(client)
|
||||
@ -154,16 +164,16 @@ class TestMsgApplysettings:
|
||||
with client:
|
||||
# No PIN protection is required.
|
||||
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
|
||||
with client:
|
||||
# No PIN protection is required.
|
||||
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
|
||||
with client:
|
||||
client.use_pin_sequence([PIN4])
|
||||
client.set_expected_responses([proto.PinMatrixRequest(), proto.Address()])
|
||||
btc.get_address(client, "Testnet", [0])
|
||||
client.set_expected_responses([pin_response, proto.Address()])
|
||||
test_address(client)
|
||||
|
Loading…
Reference in New Issue
Block a user