mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-17 01:52:02 +00:00
fix ButtonRequestType in Ping and GetEntropy
This commit is contained in:
parent
cff0b5fbf7
commit
b7f5849ecc
@ -23,7 +23,7 @@ class TestMsgGetentropy(common.TrezorTest):
|
||||
def test_entropy(self):
|
||||
for l in [0, 1, 2, 3, 4, 5, 8, 9, 16, 17, 32, 33, 64, 65, 128, 129, 256, 257, 512, 513, 1024]:
|
||||
with self.client:
|
||||
self.client.set_expected_responses([proto.ButtonRequest(code=proto_types.ButtonRequest_Other), proto.Entropy()])
|
||||
self.client.set_expected_responses([proto.ButtonRequest(code=proto_types.ButtonRequest_ProtectCall), proto.Entropy()])
|
||||
ent = self.client.get_entropy(l)
|
||||
self.assertTrue(len(ent) >= l)
|
||||
print 'entropy = ', entropy(ent)
|
||||
|
@ -16,7 +16,7 @@ class TestPing(common.TrezorTest):
|
||||
self.assertEqual(res, 'random data')
|
||||
|
||||
with self.client:
|
||||
self.client.set_expected_responses([proto.ButtonRequest(code=proto_types.ButtonRequest_Other), proto.Success()])
|
||||
self.client.set_expected_responses([proto.ButtonRequest(code=proto_types.ButtonRequest_ProtectCall), proto.Success()])
|
||||
res = self.client.ping('random data', button_protection=True)
|
||||
self.assertEqual(res, 'random data')
|
||||
|
||||
@ -34,13 +34,13 @@ class TestPing(common.TrezorTest):
|
||||
self.setup_mnemonic_pin_passphrase()
|
||||
|
||||
with self.client:
|
||||
self.client.set_expected_responses([proto.ButtonRequest(code=proto_types.ButtonRequest_Other), proto.PinMatrixRequest(), proto.PassphraseRequest(), proto.Success()])
|
||||
self.client.set_expected_responses([proto.ButtonRequest(code=proto_types.ButtonRequest_ProtectCall), proto.PinMatrixRequest(), proto.PassphraseRequest(), proto.Success()])
|
||||
res = self.client.ping('random data', button_protection=True, pin_protection=True, passphrase_protection=True)
|
||||
self.assertEqual(res, 'random data')
|
||||
|
||||
with self.client:
|
||||
# pin and passphrase are cached
|
||||
self.client.set_expected_responses([proto.ButtonRequest(code=proto_types.ButtonRequest_Other), proto.Success()])
|
||||
self.client.set_expected_responses([proto.ButtonRequest(code=proto_types.ButtonRequest_ProtectCall), proto.Success()])
|
||||
res = self.client.ping('random data', button_protection=True, pin_protection=True, passphrase_protection=True)
|
||||
self.assertEqual(res, 'random data')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user