mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +00:00
tests: stellar test for get address
This commit is contained in:
parent
c0a823ca1c
commit
d3d9ceb0c4
@ -1102,6 +1102,10 @@ class ProtocolMixin(object):
|
||||
def stellar_get_public_key(self, address_n):
|
||||
return self.call(proto.StellarGetPublicKey(address_n=address_n))
|
||||
|
||||
@expect(proto.StellarAddress)
|
||||
def stellar_get_address(self, address_n):
|
||||
return self.call(proto.StellarGetAddress(address_n=address_n))
|
||||
|
||||
def stellar_sign_transaction(self, tx, operations, address_n, network_passphrase=None):
|
||||
# default networkPassphrase to the public network
|
||||
if network_passphrase is None:
|
||||
|
44
trezorlib/tests/device_tests/test_msg_stellar_get_address.py
Normal file
44
trezorlib/tests/device_tests/test_msg_stellar_get_address.py
Normal file
@ -0,0 +1,44 @@
|
||||
# This file is part of the TREZOR project.
|
||||
#
|
||||
# This library is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This library is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
import pytest
|
||||
|
||||
from .common import TrezorTest
|
||||
from .conftest import TREZOR_VERSION
|
||||
from binascii import hexlify
|
||||
from trezorlib import stellar
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
|
||||
@pytest.mark.stellar
|
||||
@pytest.mark.xfail(TREZOR_VERSION == 1, reason="T1 support for get address is not yet finished")
|
||||
@pytest.mark.xfail(TREZOR_VERSION == 2, reason="T2 support is not yet finished")
|
||||
class TestMsgStellarGetAddress(TrezorTest):
|
||||
|
||||
def test_stellar_get_address(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
|
||||
# GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW
|
||||
response = self.client.stellar_get_address(parse_path(stellar.DEFAULT_BIP32_PATH))
|
||||
assert response.address == 'GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW'
|
||||
|
||||
def test_stellar_get_address_get_pubkey(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
|
||||
pubkey_response = self.client.stellar_get_public_key(parse_path(stellar.DEFAULT_BIP32_PATH))
|
||||
|
||||
# GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW
|
||||
address_response = self.client.stellar_get_address(parse_path(stellar.DEFAULT_BIP32_PATH))
|
||||
|
||||
assert stellar.address_from_public_key(pubkey_response.public_key).decode('utf8') == address_response.address
|
@ -16,6 +16,7 @@ import pytest
|
||||
|
||||
from .common import TrezorTest
|
||||
from .conftest import TREZOR_VERSION
|
||||
from binascii import hexlify
|
||||
from trezorlib import stellar
|
||||
from trezorlib.tools import parse_path
|
||||
|
||||
@ -24,9 +25,10 @@ from trezorlib.tools import parse_path
|
||||
@pytest.mark.xfail(TREZOR_VERSION == 2, reason="T2 support is not yet finished")
|
||||
class TestMsgStellarGetPublicKey(TrezorTest):
|
||||
|
||||
def test_stellar_get_address(self):
|
||||
def test_stellar_get_public_key(self):
|
||||
self.setup_mnemonic_nopin_nopassphrase()
|
||||
|
||||
# GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW
|
||||
response = self.client.stellar_get_public_key(parse_path(stellar.DEFAULT_BIP32_PATH))
|
||||
assert hexlify(response.public_key) == b'15d648bfe4d36f196cfb5735ffd8ca54cd4b8233f743f22449de7cf301cdb469'
|
||||
assert stellar.address_from_public_key(response.public_key) == b'GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW'
|
||||
|
Loading…
Reference in New Issue
Block a user