1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

add button_wait feature for tests

This commit is contained in:
Pavol Rusnak 2014-12-10 15:26:18 +01:00
parent 2ffdff9816
commit 610547cf32
2 changed files with 8 additions and 0 deletions

View File

@ -10,6 +10,7 @@ class TrezorTest(unittest.TestCase):
self.transport = config.TRANSPORT(*config.TRANSPORT_ARGS, **config.TRANSPORT_KWARGS)
self.client = TrezorDebugClient(self.transport)
self.client.set_debuglink(self.debug_transport)
# self.client.set_buttonwait(3)
self.client.set_tx_api(TXAPIBitcoin())
# 1 2 3 4 5 6 7 8 9 10 11 12

View File

@ -209,6 +209,7 @@ class DebugLinkMixin(object):
super(DebugLinkMixin, self).__init__(*args, **kwargs)
self.debug = None
self.in_with_statement = 0
self.button_wait = 0
self.screenshot_id = 0
# Always press Yes and provide correct pin
@ -228,6 +229,9 @@ class DebugLinkMixin(object):
def set_debuglink(self, debug_transport):
self.debug = DebugLink(debug_transport)
def set_buttonwait(self, secs):
self.button_wait = secs
def __enter__(self):
# For usage in with/expected_responses
self.in_with_statement += 1
@ -305,6 +309,9 @@ class DebugLinkMixin(object):
log("ButtonRequest code: " + get_buttonrequest_value(msg.code))
log("Pressing button " + str(self.button))
if self.button_wait:
log("Waiting %d seconds " % self.button_wait)
time.sleep(self.button_wait)
self.debug.press_button(self.button)
return proto.ButtonAck()