1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-27 01:48:17 +00:00

tests/stellar: missing field annotation

This commit is contained in:
Tomas Susanka 2018-06-11 17:23:24 +02:00 committed by matejcik
parent d3d9ceb0c4
commit 22872c53c2
3 changed files with 9 additions and 8 deletions

View File

@ -1098,10 +1098,12 @@ class ProtocolMixin(object):
return self.call(proto.SelfTest(payload=b'\x00\xFF\x55\xAA\x66\x99\x33\xCCABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\x00\xFF\x55\xAA\x66\x99\x33\xCC')) return self.call(proto.SelfTest(payload=b'\x00\xFF\x55\xAA\x66\x99\x33\xCCABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!\x00\xFF\x55\xAA\x66\x99\x33\xCC'))
@field('public_key')
@expect(proto.StellarPublicKey) @expect(proto.StellarPublicKey)
def stellar_get_public_key(self, address_n): def stellar_get_public_key(self, address_n):
return self.call(proto.StellarGetPublicKey(address_n=address_n)) return self.call(proto.StellarGetPublicKey(address_n=address_n))
@field('address')
@expect(proto.StellarAddress) @expect(proto.StellarAddress)
def stellar_get_address(self, address_n): def stellar_get_address(self, address_n):
return self.call(proto.StellarGetAddress(address_n=address_n)) return self.call(proto.StellarGetAddress(address_n=address_n))

View File

@ -30,15 +30,14 @@ class TestMsgStellarGetAddress(TrezorTest):
self.setup_mnemonic_nopin_nopassphrase() self.setup_mnemonic_nopin_nopassphrase()
# GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW # GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW
response = self.client.stellar_get_address(parse_path(stellar.DEFAULT_BIP32_PATH)) address = self.client.stellar_get_address(parse_path(stellar.DEFAULT_BIP32_PATH))
assert response.address == 'GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW' assert address == 'GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW'
def test_stellar_get_address_get_pubkey(self): def test_stellar_get_address_get_pubkey(self):
self.setup_mnemonic_nopin_nopassphrase() self.setup_mnemonic_nopin_nopassphrase()
pubkey_response = self.client.stellar_get_public_key(parse_path(stellar.DEFAULT_BIP32_PATH)) pubkey = self.client.stellar_get_public_key(parse_path(stellar.DEFAULT_BIP32_PATH))
# GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW # GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW
address_response = self.client.stellar_get_address(parse_path(stellar.DEFAULT_BIP32_PATH)) address = 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 assert stellar.address_from_public_key(pubkey).decode('utf8') == address

View File

@ -30,5 +30,5 @@ class TestMsgStellarGetPublicKey(TrezorTest):
# GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW # GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW
response = self.client.stellar_get_public_key(parse_path(stellar.DEFAULT_BIP32_PATH)) response = self.client.stellar_get_public_key(parse_path(stellar.DEFAULT_BIP32_PATH))
assert hexlify(response.public_key) == b'15d648bfe4d36f196cfb5735ffd8ca54cd4b8233f743f22449de7cf301cdb469' assert hexlify(response) == b'15d648bfe4d36f196cfb5735ffd8ca54cd4b8233f743f22449de7cf301cdb469'
assert stellar.address_from_public_key(response.public_key) == b'GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW' assert stellar.address_from_public_key(response) == b'GAK5MSF74TJW6GLM7NLTL76YZJKM2S4CGP3UH4REJHPHZ4YBZW2GSBPW'