mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-08 22:40:59 +00:00
and test_pings for combinations of input params
This commit is contained in:
parent
17e28c0e10
commit
6ee8d7d949
37
tests/test_pings.py
Normal file
37
tests/test_pings.py
Normal file
@ -0,0 +1,37 @@
|
||||
import time
|
||||
import unittest
|
||||
import common
|
||||
|
||||
from trezorlib import messages_pb2 as proto
|
||||
from trezorlib import types_pb2 as types
|
||||
|
||||
class TestPing(common.TrezorTest):
|
||||
|
||||
def test_ping(self):
|
||||
|
||||
res = self.client.ping('random data')
|
||||
self.assertEqual(res, 'random data')
|
||||
|
||||
res = self.client.ping('random data', button_protection=True)
|
||||
self.assertEqual(res, 'random data')
|
||||
|
||||
res = self.client.ping('random data', pin_protection=True)
|
||||
self.assertEqual(res, 'random data')
|
||||
|
||||
res = self.client.ping('random data', passphrase_protection=True)
|
||||
self.assertEqual(res, 'random data')
|
||||
|
||||
res = self.client.ping('random data', button_protection=True, pin_protection=True)
|
||||
self.assertEqual(res, 'random data')
|
||||
|
||||
res = self.client.ping('random data', button_protection=True, passphrase_protection=True)
|
||||
self.assertEqual(res, 'random data')
|
||||
|
||||
res = self.client.ping('random data', pin_protection=True, passphrase_protection=True)
|
||||
self.assertEqual(res, 'random data')
|
||||
|
||||
res = self.client.ping('random data', button_protection=True, pin_protection=True, passphrase_protection=True)
|
||||
self.assertEqual(res, 'random data')
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
@ -111,12 +111,11 @@ class TrezorClient(object):
|
||||
def get_entropy(self, size):
|
||||
return self.call(proto.GetEntropy(size=size), proto.Entropy).entropy
|
||||
|
||||
def ping(self, msg, button_protection=True, pin_protection=True, passphrase_protection=True):
|
||||
def ping(self, msg, button_protection=False, pin_protection=False, passphrase_protection=False):
|
||||
msg = proto.Ping(message=msg,
|
||||
button_protection=button_protection,
|
||||
pin_protection=pin_protection,
|
||||
passphrase_protection=passphrase_protection)
|
||||
|
||||
return self.call(msg, proto.Success).message
|
||||
|
||||
def get_device_id(self):
|
||||
|
Loading…
Reference in New Issue
Block a user