2018-06-21 14:28:34 +00:00
|
|
|
# This file is part of the Trezor project.
|
2017-09-03 13:45:19 +00:00
|
|
|
#
|
2019-05-29 16:44:09 +00:00
|
|
|
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
2017-09-03 13:45:19 +00:00
|
|
|
#
|
|
|
|
# This library is free software: you can redistribute it and/or modify
|
2018-06-21 14:28:34 +00:00
|
|
|
# it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
# as published by the Free Software Foundation.
|
2017-09-03 13:45:19 +00:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#
|
2018-06-21 14:28:34 +00:00
|
|
|
# You should have received a copy of the License along with this library.
|
|
|
|
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
|
2017-09-03 13:45:19 +00:00
|
|
|
|
2018-04-18 13:53:40 +00:00
|
|
|
import pytest
|
|
|
|
|
2018-08-10 12:04:58 +00:00
|
|
|
from trezorlib import nem
|
2022-01-31 12:25:30 +00:00
|
|
|
from trezorlib.debuglink import TrezorClientDebugLink as Client
|
2018-08-13 16:21:24 +00:00
|
|
|
from trezorlib.tools import parse_path
|
|
|
|
|
2021-11-10 20:24:45 +00:00
|
|
|
from ...common import MNEMONIC12
|
2017-09-03 13:45:19 +00:00
|
|
|
|
|
|
|
|
2019-08-22 16:47:01 +00:00
|
|
|
@pytest.mark.altcoin
|
device_tests: allow custom runxfail
We can now selectively runxfail certain tests. This is useful for
accepting PRs into trezor-core:
1. trezor-core is going to get a pytest.ini that sets xfail_strict.
That means that if an `xfail`ed test actually passes, that will
break the test suite. So it will be visible when we implement
a feature for which tests exist.
2. To allow PRs to pass the test suite without touching python-trezor
directly, we add a new pytest.ini option: run_xfail.
This adds a list of markers which will ignore `xfail`.
So:
2.1 First, the python-trezor PR marks the tests with the name
of the feature. This commit already does that: Lisk tests
are marked `@pytest.mark.lisk`, NEMs are `@pytest.mark.nem`,
etc.
The tests will be also marked with `xfail`, because the
feature is not in core yet.
2.2 Then, the trezor-core PR implements the feature, which makes
the `xfail`ed tests pass. That breaks the test suite.
2.3 To fix the test suite, the core PR also adds a `run_xfail`
to `pytest.ini`: `run_xfail = lisk`.
(it can take a list: `run_xfail = lisk nem stellar`)
That will make the test suite behave as if the tests are not
`xfail`ed. If the feature is implemented correctly, the tests
will pass.
2.4 When the PR is accepted to core, the next step should be
a PR to python-trezor that removes the `xfail`s. After that,
we should also remove the `run_xfail` option, just to be tidy.
2018-05-21 15:44:02 +00:00
|
|
|
@pytest.mark.nem
|
2021-11-10 21:19:53 +00:00
|
|
|
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
2022-01-31 12:25:30 +00:00
|
|
|
def test_nem_getaddress(client: Client):
|
2021-11-10 21:19:53 +00:00
|
|
|
assert (
|
|
|
|
nem.get_address(
|
2022-01-31 12:25:30 +00:00
|
|
|
client, parse_path("m/44h/1h/0h/0h/0h"), 0x68, show_display=True
|
2018-08-13 16:21:24 +00:00
|
|
|
)
|
2021-11-10 21:19:53 +00:00
|
|
|
== "NB3JCHVARQNGDS3UVGAJPTFE22UQFGMCQGHUBWQN"
|
|
|
|
)
|
|
|
|
assert (
|
|
|
|
nem.get_address(
|
2022-01-31 12:25:30 +00:00
|
|
|
client, parse_path("m/44h/1h/0h/0h/0h"), 0x98, show_display=True
|
2018-08-13 16:21:24 +00:00
|
|
|
)
|
2021-11-10 21:19:53 +00:00
|
|
|
== "TB3JCHVARQNGDS3UVGAJPTFE22UQFGMCQHSBNBMF"
|
|
|
|
)
|