1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-23 06:48:16 +00:00

add read_passphrase_protection to debuglink

This commit is contained in:
Pavol Rusnak 2014-02-17 02:16:43 +01:00
parent 74f3502637
commit b63418c8b8
5 changed files with 65 additions and 0 deletions

34
tests/test_device_load.py Normal file
View File

@ -0,0 +1,34 @@
import unittest
import common
from trezorlib import messages_pb2 as messages
class TestDeviceLoad(common.TrezorTest):
def test_load_device_1(self):
self.setup_mnemonic_nopin_nopassphrase()
mnemonic = self.client.debug.read_mnemonic()
self.assertEqual(mnemonic, self.mnemonic12)
pin = self.client.debug.read_pin()[0]
self.assertEqual(pin, '')
passphrase_protection = self.client.debug.read_passphrase_protection()
self.assertEqual(passphrase_protection, False)
def test_load_device_2(self):
self.setup_mnemonic_pin_passphrase()
mnemonic = self.client.debug.read_mnemonic()
self.assertEqual(mnemonic, self.mnemonic12)
pin = self.client.debug.read_pin()[0]
self.assertEqual(pin, self.pin4)
passphrase_protection = self.client.debug.read_passphrase_protection()
self.assertEqual(passphrase_protection, True)
if __name__ == '__main__':
unittest.main()

View File

@ -0,0 +1,12 @@
import unittest
import common
from trezorlib import messages_pb2 as messages
class TestDeviceRecover(common.TrezorTest):
def test_recover_device(self):
pass
if __name__ == '__main__':
unittest.main()

View File

@ -0,0 +1,12 @@
import unittest
import common
from trezorlib import messages_pb2 as messages
class TestDeviceReset(common.TrezorTest):
def test_reset_device(self):
pass
if __name__ == '__main__':
unittest.main()

View File

@ -322,6 +322,8 @@ class TestSignTx(common.TrezorTest):
self.assert_(False, "types.Failure_NotEnoughFunds expected")
def test_estimate_size(self):
self.setup_mnemonic_nopin_nopassphrase()
inp1 = proto_types.TxInputType(address_n=[0], # 14LmW5k4ssUrtbAB4255zdqv3b4w1TuX9e
# amount=390000,
prev_hash=binascii.unhexlify('d5f65ee80147b4bcc70b75e4bbf2d7382021b871bd8867ef8fa525ef50864882'),

View File

@ -54,6 +54,11 @@ class DebugLink(object):
obj = self.transport.read_blocking()
return obj.node
def read_passphrase_protection(self):
self.transport.write(proto.DebugLinkGetState())
obj = self.transport.read_blocking()
return obj.passphrase_protection
def press_button(self, yes_no):
print "Pressing", yes_no
self.button_func(yes_no)