1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-05 13:01:12 +00:00

tests: add test in resetdevice for combination of display_random and no_backup

This commit is contained in:
Pavol Rusnak 2018-10-08 15:54:02 +02:00
parent cd006026dd
commit 00ebbbb1f3
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D

View File

@ -20,15 +20,16 @@ from .common import TrezorTest
class TestMsgResetDeviceNobackup(TrezorTest): class TestMsgResetDeviceNobackup(TrezorTest):
def test_reset_device_no_backup(self):
external_entropy = b"zlutoucky kun upel divoke ody" * 2 external_entropy = b"zlutoucky kun upel divoke ody" * 2
strength = 128 strength = 128
def test_reset_device_no_backup(self):
ret = self.client.call_raw( ret = self.client.call_raw(
proto.ResetDevice( proto.ResetDevice(
display_random=False, display_random=False,
strength=strength, strength=self.strength,
passphrase_protection=False, passphrase_protection=False,
pin_protection=False, pin_protection=False,
language="english", language="english",
@ -39,7 +40,7 @@ class TestMsgResetDeviceNobackup(TrezorTest):
# Provide entropy # Provide entropy
assert isinstance(ret, proto.EntropyRequest) assert isinstance(ret, proto.EntropyRequest)
ret = self.client.call_raw(proto.EntropyAck(entropy=external_entropy)) ret = self.client.call_raw(proto.EntropyAck(entropy=self.external_entropy))
assert isinstance(ret, proto.Success) assert isinstance(ret, proto.Success)
# Check if device is properly initialized # Check if device is properly initialized
@ -52,3 +53,17 @@ class TestMsgResetDeviceNobackup(TrezorTest):
# start backup - should fail # start backup - should fail
ret = self.client.call_raw(proto.BackupDevice()) ret = self.client.call_raw(proto.BackupDevice())
assert isinstance(ret, proto.Failure) assert isinstance(ret, proto.Failure)
def test_reset_device_no_backup_show_entropy_fail(self):
ret = self.client.call_raw(
proto.ResetDevice(
display_random=True,
strength=self.strength,
passphrase_protection=False,
pin_protection=False,
language="english",
label="test",
no_backup=True,
)
)
assert isinstance(ret, proto.Failure)