1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-14 03:30:02 +00:00

Improve test slightly

This commit is contained in:
M1nd3r 2024-03-14 16:26:31 +01:00 committed by M1nd3r
parent fa82bb1132
commit 7200af7547

View File

@ -101,12 +101,10 @@ class TestWireTrezorHostProtocolV1(unittest.TestCase):
gen = thp_v1.read_message(self.interface, buffer)
query = gen.send(None)
self.assertObjectEqual(query, self.interface.wait_object(io.POLL_READ))
gen.send(cid_req_message)
gen.send(None)
gen.send(message)
with self.assertRaises(StopIteration) as e:
gen.send(cid_req_message)
gen.send(None)
gen.send(message)
gen.send(None)
gen.send(None)
# e.value is StopIteration. e.value.value is the return value of the call
@ -133,10 +131,8 @@ class TestWireTrezorHostProtocolV1(unittest.TestCase):
query = gen.send(None)
self.assertObjectEqual(query, self.interface.wait_object(io.POLL_READ))
gen.send(message)
with self.assertRaises(StopIteration) as e:
gen.send(message)
gen.send(None)
gen.send(None)
# e.value is StopIteration. e.value.value is the return value of the call
@ -211,9 +207,8 @@ class TestWireTrezorHostProtocolV1(unittest.TestCase):
gen = thp_v1.read_message(self.interface, buffer)
query = gen.send(None)
self.assertObjectEqual(query, self.interface.wait_object(io.POLL_READ))
gen.send(packet)
with self.assertRaises(StopIteration) as e:
gen.send(packet)
gen.send(None)
gen.send(None)
# e.value is StopIteration. e.value.value is the return value of the call