From a11ec58eb6610462127b2da3f392d835b55e1574 Mon Sep 17 00:00:00 2001 From: matejcik Date: Tue, 19 May 2020 15:06:19 +0200 Subject: [PATCH] tests: enable auto-lock tests for TT --- tests/device_tests/test_msg_applysettings.py | 30 +++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/tests/device_tests/test_msg_applysettings.py b/tests/device_tests/test_msg_applysettings.py index 6e19526e3..da92be76b 100644 --- a/tests/device_tests/test_msg_applysettings.py +++ b/tests/device_tests/test_msg_applysettings.py @@ -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)