1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00

tests: update T1+T2 reset+recovery tests to reflect new Confirm dialog

This commit is contained in:
Pavol Rusnak 2018-10-22 14:44:36 +02:00
parent 1a239201d8
commit 1397c3b4d9
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
5 changed files with 51 additions and 0 deletions

View File

@ -36,6 +36,11 @@ class TestMsgRecoverydeviceT2(TrezorTest):
)
)
# Confirm Recovery
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.press_yes()
ret = self.client.call_raw(proto.ButtonAck())
# Enter word count
assert ret == proto.ButtonRequest(
code=proto.ButtonRequestType.MnemonicWordCount
@ -82,6 +87,11 @@ class TestMsgRecoverydeviceT2(TrezorTest):
)
)
# Confirm Recovery
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.press_yes()
ret = self.client.call_raw(proto.ButtonAck())
# Enter word count
assert ret == proto.ButtonRequest(
code=proto.ButtonRequestType.MnemonicWordCount

View File

@ -41,6 +41,10 @@ class TestMsgResetDevice(TrezorTest):
)
)
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.press_yes()
ret = self.client.call_raw(proto.ButtonAck())
# Provide entropy
assert isinstance(ret, proto.EntropyRequest)
internal_entropy = self.client.debug.read_reset_entropy()
@ -110,6 +114,10 @@ class TestMsgResetDevice(TrezorTest):
self.client.debug.press_yes()
ret = self.client.call_raw(proto.ButtonAck())
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.press_yes()
ret = self.client.call_raw(proto.ButtonAck())
assert isinstance(ret, proto.PinMatrixRequest)
# Enter PIN for first time
@ -192,6 +200,10 @@ class TestMsgResetDevice(TrezorTest):
self.client.debug.press_yes()
ret = self.client.call_raw(proto.ButtonAck())
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.press_yes()
ret = self.client.call_raw(proto.ButtonAck())
assert isinstance(ret, proto.PinMatrixRequest)
# Enter PIN for first time

View File

@ -38,6 +38,10 @@ class TestMsgResetDeviceNobackup(TrezorTest):
)
)
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.press_yes()
ret = self.client.call_raw(proto.ButtonAck())
# Provide entropy
assert isinstance(ret, proto.EntropyRequest)
ret = self.client.call_raw(proto.EntropyAck(entropy=self.external_entropy))

View File

@ -42,6 +42,10 @@ class TestMsgResetDeviceSkipbackup(TrezorTest):
)
)
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.press_yes()
ret = self.client.call_raw(proto.ButtonAck())
# Provide entropy
assert isinstance(ret, proto.EntropyRequest)
internal_entropy = self.client.debug.read_reset_entropy()
@ -108,6 +112,10 @@ class TestMsgResetDeviceSkipbackup(TrezorTest):
)
)
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.press_yes()
ret = self.client.call_raw(proto.ButtonAck())
# Provide entropy
assert isinstance(ret, proto.EntropyRequest)
ret = self.client.call_raw(proto.EntropyAck(entropy=self.external_entropy))

View File

@ -35,6 +35,11 @@ class TestMsgResetDeviceT2(TrezorTest):
strength = 128
def input_flow():
# Confirm Reset
btn_code = yield
assert btn_code == B.ResetDevice
self.client.debug.press_yes()
# Backup your seed
btn_code = yield
assert btn_code == B.ResetDevice
@ -68,6 +73,7 @@ class TestMsgResetDeviceT2(TrezorTest):
with mock.patch("os.urandom", os_urandom), self.client:
self.client.set_expected_responses(
[
proto.ButtonRequest(code=B.ResetDevice),
proto.EntropyRequest(),
proto.ButtonRequest(code=B.ResetDevice),
proto.ButtonRequest(code=B.ResetDevice),
@ -109,6 +115,11 @@ class TestMsgResetDeviceT2(TrezorTest):
strength = 128
def input_flow():
# Confirm Reset
btn_code = yield
assert btn_code == B.ResetDevice
self.client.debug.press_yes()
# Enter new PIN
yield
self.client.debug.input("654")
@ -155,6 +166,7 @@ class TestMsgResetDeviceT2(TrezorTest):
with mock.patch("os.urandom", os_urandom), self.client:
self.client.set_expected_responses(
[
proto.ButtonRequest(code=B.ResetDevice),
proto.ButtonRequest(code=B.Other),
proto.ButtonRequest(code=B.Other),
proto.ButtonRequest(code=B.ResetDevice),
@ -201,6 +213,11 @@ class TestMsgResetDeviceT2(TrezorTest):
proto.ResetDevice(strength=strength, pin_protection=True, label="test")
)
# Confirm Reset
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.press_yes()
ret = self.client.call_raw(proto.ButtonAck())
# Enter PIN for first time
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.input("654")