1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-22 22:38:08 +00:00

device_tests: add failing tests for stellar

This commit is contained in:
Pavol Rusnak 2018-06-11 19:22:16 +02:00
parent 7cf46c6833
commit 015d72102d
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 22 additions and 0 deletions

View File

@ -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')

View File

@ -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')