diff --git a/tests/test_device_load.py b/tests/test_device_load.py new file mode 100644 index 0000000..39e59a5 --- /dev/null +++ b/tests/test_device_load.py @@ -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() diff --git a/tests/test_device_recover.py b/tests/test_device_recover.py new file mode 100644 index 0000000..1f634c7 --- /dev/null +++ b/tests/test_device_recover.py @@ -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() diff --git a/tests/test_device_reset.py b/tests/test_device_reset.py new file mode 100644 index 0000000..d0bfe29 --- /dev/null +++ b/tests/test_device_reset.py @@ -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() diff --git a/tests/test_signtx.py b/tests/test_signtx.py index 4346f0c..4dbd2c4 100644 --- a/tests/test_signtx.py +++ b/tests/test_signtx.py @@ -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'), diff --git a/trezorlib/debuglink.py b/trezorlib/debuglink.py index 9021cc8..c6d9897 100644 --- a/trezorlib/debuglink.py +++ b/trezorlib/debuglink.py @@ -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)