diff --git a/trezorlib/tests/device_tests/common.py b/trezorlib/tests/device_tests/common.py index 5c8a0a713..519a4e522 100644 --- a/trezorlib/tests/device_tests/common.py +++ b/trezorlib/tests/device_tests/common.py @@ -43,7 +43,7 @@ class TrezorTest: def teardown_method(self, method): self.client.close() - def _setup_mnemonic(self, mnemonic=None, pin="", passphrase=False): + def _setup_mnemonic(self, mnemonic=None, pin="", passphrase=False, lock=True): if mnemonic is None: mnemonic = TrezorTest.mnemonic12 debuglink.load_device_by_mnemonic( @@ -54,26 +54,26 @@ class TrezorTest: label="test", language="english", ) - if conftest.TREZOR_VERSION == 1: + if conftest.TREZOR_VERSION == 1 and lock: # 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) - def setup_mnemonic_allallall(self): - self._setup_mnemonic(mnemonic=TrezorTest.mnemonic_all) + def setup_mnemonic_allallall(self, lock=True): + self._setup_mnemonic(mnemonic=TrezorTest.mnemonic_all, lock=lock) - def setup_mnemonic_nopin_nopassphrase(self): - self._setup_mnemonic() + def setup_mnemonic_nopin_nopassphrase(self, lock=True): + self._setup_mnemonic(lock=lock) - def setup_mnemonic_nopin_passphrase(self): - self._setup_mnemonic(passphrase=True) + def setup_mnemonic_nopin_passphrase(self, lock=True): + self._setup_mnemonic(passphrase=True, lock=lock) - def setup_mnemonic_pin_nopassphrase(self): - self._setup_mnemonic(pin=TrezorTest.pin4) + def setup_mnemonic_pin_nopassphrase(self, lock=True): + self._setup_mnemonic(pin=TrezorTest.pin4, lock=lock) - def setup_mnemonic_pin_passphrase(self): - self._setup_mnemonic(pin=TrezorTest.pin4, passphrase=True) + def setup_mnemonic_pin_passphrase(self, lock=True): + self._setup_mnemonic(pin=TrezorTest.pin4, passphrase=True, lock=lock) def generate_entropy(strength, internal_entropy, external_entropy): diff --git a/trezorlib/tests/device_tests/test_debuglink.py b/trezorlib/tests/device_tests/test_debuglink.py index ab5f7d20c..deadfc183 100644 --- a/trezorlib/tests/device_tests/test_debuglink.py +++ b/trezorlib/tests/device_tests/test_debuglink.py @@ -28,7 +28,7 @@ class TestDebuglink(TrezorTest): assert len(layout) == 1024 def test_mnemonic(self): - self.setup_mnemonic_nopin_nopassphrase() + self.setup_mnemonic_nopin_nopassphrase(lock=False) mnemonic = self.client.debug.state().mnemonic assert mnemonic == self.mnemonic12 diff --git a/trezorlib/tests/device_tests/test_msg_loaddevice.py b/trezorlib/tests/device_tests/test_msg_loaddevice.py index 2974d64cd..e3e283972 100644 --- a/trezorlib/tests/device_tests/test_msg_loaddevice.py +++ b/trezorlib/tests/device_tests/test_msg_loaddevice.py @@ -24,7 +24,7 @@ from .common import TrezorTest @pytest.mark.skip_t2 class TestDeviceLoad(TrezorTest): def test_load_device_1(self): - self.setup_mnemonic_nopin_nopassphrase() + self.setup_mnemonic_nopin_nopassphrase(lock=False) state = self.client.debug.state() assert state.mnemonic == self.mnemonic12 assert state.pin is None @@ -34,7 +34,7 @@ class TestDeviceLoad(TrezorTest): assert address == "1EfKbQupktEMXf4gujJ9kCFo83k1iMqwqK" def test_load_device_2(self): - self.setup_mnemonic_pin_passphrase() + self.setup_mnemonic_pin_passphrase(lock=False) self.client.set_passphrase("passphrase") state = self.client.debug.state() assert state.mnemonic == self.mnemonic12