From 831fde9c5c95624dba0c007fb3948c07583853c3 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 14 Dec 2018 15:17:14 +0100 Subject: [PATCH] tests: T1 now caches the PIN after PIN set/change --- trezorlib/tests/device_tests/common.py | 3 +++ trezorlib/tests/device_tests/test_msg_changepin.py | 6 ------ trezorlib/tests/device_tests/test_msg_recoverydevice.py | 5 ----- trezorlib/tests/device_tests/test_msg_resetdevice.py | 5 ----- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/trezorlib/tests/device_tests/common.py b/trezorlib/tests/device_tests/common.py index 0d351481a..18dbb7d3e 100644 --- a/trezorlib/tests/device_tests/common.py +++ b/trezorlib/tests/device_tests/common.py @@ -56,6 +56,9 @@ class TrezorTest: label="test", language="english", ) + if conftest.TREZOR_VERSION == 1: + # remove cached PIN (introduced via load_device) + self.client.clear_session() if conftest.TREZOR_VERSION > 1 and passphrase: device.apply_settings(self.client, passphrase_source=PASSPHRASE_ON_HOST) diff --git a/trezorlib/tests/device_tests/test_msg_changepin.py b/trezorlib/tests/device_tests/test_msg_changepin.py index d9a27e326..5590f5e24 100644 --- a/trezorlib/tests/device_tests/test_msg_changepin.py +++ b/trezorlib/tests/device_tests/test_msg_changepin.py @@ -56,9 +56,6 @@ class TestMsgChangepin(TrezorTest): # Check that there's PIN protection now features = self.client.call_raw(proto.Initialize()) assert features.pin_protection is True - ret = self.client.call_raw(proto.Ping(pin_protection=True)) - assert isinstance(ret, proto.PinMatrixRequest) - self.client.call_raw(proto.Cancel()) # Check that the PIN is correct assert self.client.debug.read_pin()[0] == self.pin6 @@ -105,9 +102,6 @@ class TestMsgChangepin(TrezorTest): # Check that there's still PIN protection now features = self.client.call_raw(proto.Initialize()) assert features.pin_protection is True - ret = self.client.call_raw(proto.Ping(pin_protection=True)) - assert isinstance(ret, proto.PinMatrixRequest) - self.client.call_raw(proto.Cancel()) # Check that the PIN is correct assert self.client.debug.read_pin()[0] == self.pin6 diff --git a/trezorlib/tests/device_tests/test_msg_recoverydevice.py b/trezorlib/tests/device_tests/test_msg_recoverydevice.py index e1e7ff5ed..c52a80624 100644 --- a/trezorlib/tests/device_tests/test_msg_recoverydevice.py +++ b/trezorlib/tests/device_tests/test_msg_recoverydevice.py @@ -85,11 +85,6 @@ class TestMsgRecoverydevice(TrezorTest): assert isinstance(resp, proto.PassphraseRequest) self.client.call_raw(proto.Cancel()) - # Do PIN-protected action, PinRequest should be raised - resp = self.client.call_raw(proto.Ping(pin_protection=True)) - assert isinstance(resp, proto.PinMatrixRequest) - self.client.call_raw(proto.Cancel()) - def test_nopin_nopassphrase(self): mnemonic = self.mnemonic12.split(" ") ret = self.client.call_raw( diff --git a/trezorlib/tests/device_tests/test_msg_resetdevice.py b/trezorlib/tests/device_tests/test_msg_resetdevice.py index 217433327..8b57837ac 100644 --- a/trezorlib/tests/device_tests/test_msg_resetdevice.py +++ b/trezorlib/tests/device_tests/test_msg_resetdevice.py @@ -176,11 +176,6 @@ class TestMsgResetDevice(TrezorTest): assert isinstance(resp, proto.PassphraseRequest) self.client.call_raw(proto.Cancel()) - # Do PIN-protected action, PinRequest should be raised - resp = self.client.call_raw(proto.Ping(pin_protection=True)) - assert isinstance(resp, proto.PinMatrixRequest) - self.client.call_raw(proto.Cancel()) - def test_failed_pin(self): # external_entropy = b'zlutoucky kun upel divoke ody' * 2 strength = 128