1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 19:18:56 +00:00

tests/device/nem: tests fixes due to layout changes

This commit is contained in:
Tomas Susanka 2018-04-05 16:02:25 +02:00
parent 24dc617f36
commit 891865f948
3 changed files with 52 additions and 66 deletions

View File

@ -53,7 +53,6 @@ class TestMsgNEMSignTxMosaics(TrezorTest):
assert hexlify(tx.signature) == b'928b03c4a69fff35ecf0912066ea705895b3028fad141197d7ea2b56f1eef2a2516455e6f35d318f6fa39e2bb40492ac4ae603260790f7ebc7ea69feb4ca4c0a'
def test_nem_signtx_mosaic_creation(self):
# todo test levy
self.setup_mnemonic_nopin_nopassphrase()
test_suite = {
@ -78,7 +77,7 @@ class TestMsgNEMSignTxMosaics(TrezorTest):
}
# not using client.nem_sign_tx() because of swiping
tx = self._nem_sign(1, test_suite)
tx = self._nem_sign(2, test_suite)
assert hexlify(tx.data) == b'01400000010000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f7404c100000020000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b40620841a0000000600000068656c6c6f6d0c00000048656c6c6f206d6f73616963050000006c6f72656d04000000150000000c00000064697669736962696c6974790100000030160000000d000000696e697469616c537570706c7901000000301a0000000d000000737570706c794d757461626c650500000066616c7365190000000c0000007472616e7366657261626c650500000066616c7365000000002800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324adc05000000000000'
assert hexlify(tx.signature) == b'537adf4fd9bd5b46e204b2db0a435257a951ed26008305e0aa9e1201dafa4c306d7601a8dbacabf36b5137724386124958d53202015ab31fb3d0849dfed2df0e'
@ -177,7 +176,7 @@ class TestMsgNEMSignTxMosaics(TrezorTest):
"creationFee": 1500,
}
tx = self._nem_sign(2, test_suite)
tx = self._nem_sign(5, test_suite)
assert hexlify(tx.data) == b'01400000010000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f74041801000020000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b40620841a0000000600000068656c6c6f6d0c00000048656c6c6f206d6f73616963050000006c6f72656d04000000150000000c00000064697669736962696c6974790100000034180000000d000000696e697469616c537570706c79030000003230301a0000000d000000737570706c794d757461626c650500000066616c7365180000000c0000007472616e7366657261626c65040000007472756556000000010000002800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324a1a0000000600000068656c6c6f6d0c00000048656c6c6f206d6f7361696302000000000000002800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324adc05000000000000'
assert hexlify(tx.signature) == b'b87aac1ddf146d35e6a7f3451f57e2fe504ac559031e010a51261257c37bd50fcfa7b2939dd7a3203b54c4807d458475182f5d3dc135ec0d1d4a9cd42159fd0a'
@ -192,7 +191,7 @@ class TestMsgNEMSignTxMosaics(TrezorTest):
self.client.transport.write(msg)
ret = self.client.transport.read()
# Confirm output
# Confirm action
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.press_yes()
self.client.transport.write(proto.ButtonAck())
@ -203,6 +202,12 @@ class TestMsgNEMSignTxMosaics(TrezorTest):
self.client.debug.press_yes()
ret = self.client.transport.read()
# Confirm action
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.press_yes()
self.client.transport.write(proto.ButtonAck())
ret = self.client.transport.read()
# Confirm tx
assert isinstance(ret, proto.ButtonRequest)
self.client.debug.press_yes()

View File

@ -17,9 +17,7 @@
from .common import *
from trezorlib import messages as proto
from trezorlib import nem
import time
# assertion data from T1
@ -43,11 +41,13 @@ class TestMsgNEMSignTxOther(TrezorTest):
"cosignatoryAccount": "c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844"
},
],
"minCosignatories": {
"relativeChange": 3
},
"version": (0x98 << 24),
})
assert hexlify(tx.data) == b'01100000010000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f740401000000280000000100000020000000c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844'
assert hexlify(tx.signature) == b'ed074a4b877e575786785e6e499e428edea28498a06bdaed6557ccdfbfe69087acd6f4b63e9faa6a849e49d405374c12762df2f27d55e4b35c1901850f83650f'
assert hexlify(tx.data) == b'01100000020000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f740401000000280000000100000020000000c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f878440400000003000000'
assert hexlify(tx.signature) == b'1200e552d8732ce3eae96719731194abfc5a09d98f61bb35684f4eeaeff15b1bdf326ee7b1bbbe89d3f68c8e07ad3daf72e4c7f031094ad2236b97918ad98601'
def test_nem_signtx_importance_transfer(self):
self.setup_mnemonic_nopin_nopassphrase()
@ -61,7 +61,7 @@ class TestMsgNEMSignTxOther(TrezorTest):
"message": {
},
"importanceTransfer": {
"mode": 1,
"mode": 1, # activate
"publicKey": "c5f54ba980fcbb657dbaaa42700539b207873e134d2375efeab5f1ab52f87844",
},
"version": (0x98 << 24),
@ -74,28 +74,19 @@ class TestMsgNEMSignTxOther(TrezorTest):
self.setup_mnemonic_nopin_nopassphrase()
with self.client:
self.client.set_expected_responses([
# Confirm provision namespace
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
# Confirm fee
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
proto.NEMSignedTx(),
])
tx = self.client.nem_sign_tx(self.client.expand_path("m/44'/1'/0'/0'/0'"), {
"timeStamp": 74649215,
"fee": 2000000,
"type": nem.TYPE_PROVISION_NAMESPACE,
"deadline": 74735615,
"message": {
},
"newPart": "ABCDE",
"rentalFeeSink": "TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J",
"rentalFee": 1500,
"parent": None,
"version": (0x98 << 24),
})
tx = self.client.nem_sign_tx(self.client.expand_path("m/44'/1'/0'/0'/0'"), {
"timeStamp": 74649215,
"fee": 2000000,
"type": nem.TYPE_PROVISION_NAMESPACE,
"deadline": 74735615,
"message": {
},
"newPart": "ABCDE",
"rentalFeeSink": "TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J",
"rentalFee": 1500,
"parent": None,
"version": (0x98 << 24),
})
assert hexlify(tx.data) == b'01200000010000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f74042800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324adc05000000000000050000004142434445ffffffff'
assert hexlify(tx.signature) == b'f047ae7987cd3a60c0d5ad123aba211185cb6266a7469dfb0491a0df6b5cd9c92b2e2b9f396cc2a3146ee185ba02df4f9e7fb238fe479917b3d274d97336640d'
assert hexlify(tx.data) == b'01200000010000987f0e730420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208480841e0000000000ff5f74042800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324adc05000000000000050000004142434445ffffffff'
assert hexlify(tx.signature) == b'f047ae7987cd3a60c0d5ad123aba211185cb6266a7469dfb0491a0df6b5cd9c92b2e2b9f396cc2a3146ee185ba02df4f9e7fb238fe479917b3d274d97336640d'

View File

@ -32,7 +32,6 @@ class TestMsgNEMSignTx(TrezorTest):
)
self.setup_mnemonic_nopin_nopassphrase()
with self.client:
self.client.set_expected_responses([
# Confirm transfer and network fee
@ -41,7 +40,7 @@ class TestMsgNEMSignTx(TrezorTest):
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
# Confirm recipient
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
proto.NEMSignedTx(signature=signature),
proto.NEMSignedTx(),
])
tx = self.client.nem_sign_tx(self.client.expand_path("m/44'/1'/0'/0'/0'"), {
@ -106,38 +105,29 @@ class TestMsgNEMSignTx(TrezorTest):
self.setup_mnemonic_nopin_nopassphrase()
with self.client:
self.client.set_expected_responses([
# Confirm transfer and network fee
proto.ButtonRequest(code=proto.ButtonRequestType.ConfirmOutput),
# Confirm recipient
proto.ButtonRequest(code=proto.ButtonRequestType.SignTx),
proto.NEMSignedTx(signature=signature),
])
tx = self.client.nem_sign_tx(self.client.expand_path("m/44'/1'/0'/0'/0'"), {
"timeStamp": 76809215,
"amount": 1000000,
"fee": 1000000,
"recipient": "TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J",
"type": nem.TYPE_TRANSACTION_TRANSFER,
"deadline": 76895615,
"version": (0x98 << 24),
"message": {
},
"mosaics": [
{
"mosaicId": {
"namespaceId": "nem",
"name": "xem",
},
"quantity": 1000000,
tx = self.client.nem_sign_tx(self.client.expand_path("m/44'/1'/0'/0'/0'"), {
"timeStamp": 76809215,
"amount": 1000000,
"fee": 1000000,
"recipient": "TALICE2GMA34CXHD7XLJQ536NM5UNKQHTORNNT2J",
"type": nem.TYPE_TRANSACTION_TRANSFER,
"deadline": 76895615,
"version": (0x98 << 24),
"message": {
},
"mosaics": [
{
"mosaicId": {
"namespaceId": "nem",
"name": "xem",
},
],
})
"quantity": 1000000,
},
],
})
assert hexlify(tx.data) == b'0101000002000098ff03940420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208440420f00000000007f5595042800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324a40420f000000000000000000010000001a0000000e000000030000006e656d0300000078656d40420f0000000000'
assert tx.signature == signature
assert hexlify(tx.data) == b'0101000002000098ff03940420000000edfd32f6e760648c032f9acb4b30d514265f6a5b5f8a7154f2618922b406208440420f00000000007f5595042800000054414c49434532474d4133344358484437584c4a513533364e4d35554e4b5148544f524e4e54324a40420f000000000000000000010000001a0000000e000000030000006e656d0300000078656d40420f0000000000'
assert tx.signature == signature
def test_nem_signtx_multiple_mosaics(self):
self.setup_mnemonic_nopin_nopassphrase()