From 015d72102d62ef1571a5f08c3a0a8c072f9f01bd Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 11 Jun 2018 19:22:16 +0200 Subject: [PATCH] device_tests: add failing tests for stellar --- .../device_tests/test_msg_stellar_get_address.py | 11 +++++++++++ .../device_tests/test_msg_stellar_get_public_key.py | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/trezorlib/tests/device_tests/test_msg_stellar_get_address.py b/trezorlib/tests/device_tests/test_msg_stellar_get_address.py index 7adbd058b0..5f75eff099 100644 --- a/trezorlib/tests/device_tests/test_msg_stellar_get_address.py +++ b/trezorlib/tests/device_tests/test_msg_stellar_get_address.py @@ -18,6 +18,8 @@ from .common import TrezorTest from .conftest import TREZOR_VERSION from binascii import hexlify from trezorlib import stellar +from trezorlib import messages as proto +from trezorlib.client import CallException from trezorlib.tools import parse_path @@ -40,3 +42,12 @@ class TestMsgStellarGetAddress(TrezorTest): address = self.client.stellar_get_address(parse_path(stellar.DEFAULT_BIP32_PATH)) assert stellar.address_from_public_key(pubkey).decode('utf8') == address + + def test_stellar_get_address_fail(self): + self.setup_mnemonic_nopin_nopassphrase() + + with pytest.raises(CallException) as exc: + self.client.stellar_get_address(parse_path('m/0/1')) + + assert exc.value.args[0] == proto.FailureType.ProcessError + assert exc.value.args[1].endswith('Failed to derive private key') diff --git a/trezorlib/tests/device_tests/test_msg_stellar_get_public_key.py b/trezorlib/tests/device_tests/test_msg_stellar_get_public_key.py index e55dd0e71b..1d07312d9a 100644 --- a/trezorlib/tests/device_tests/test_msg_stellar_get_public_key.py +++ b/trezorlib/tests/device_tests/test_msg_stellar_get_public_key.py @@ -18,6 +18,8 @@ from .common import TrezorTest from .conftest import TREZOR_VERSION from binascii import hexlify from trezorlib import stellar +from trezorlib import messages as proto +from trezorlib.client import CallException from trezorlib.tools import parse_path @@ -32,3 +34,12 @@ class TestMsgStellarGetPublicKey(TrezorTest): response = self.client.stellar_get_public_key(parse_path(stellar.DEFAULT_BIP32_PATH)) assert hexlify(response) == b'15d648bfe4d36f196cfb5735ffd8ca54cd4b8233f743f22449de7cf301cdb469' assert stellar.address_from_public_key(response) == b'GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW' + + def test_stellar_get_public_key_fail(self): + self.setup_mnemonic_nopin_nopassphrase() + + with pytest.raises(CallException) as exc: + self.client.stellar_get_public_key(parse_path('m/0/1')) + + assert exc.value.args[0] == proto.FailureType.ProcessError + assert exc.value.args[1].endswith('Failed to derive private key')