2018-06-21 14:28:34 +00:00
|
|
|
# This file is part of the Trezor project.
|
2018-04-16 14:38:00 +00:00
|
|
|
#
|
2019-05-29 16:44:09 +00:00
|
|
|
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
2018-04-16 14:38:00 +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.
|
2018-04-16 14:38:00 +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>.
|
2018-04-16 14:38:00 +00:00
|
|
|
|
2018-04-18 13:46:10 +00:00
|
|
|
import pytest
|
2018-04-16 14:38:00 +00:00
|
|
|
|
2018-08-10 12:04:58 +00:00
|
|
|
from trezorlib import lisk
|
2018-08-10 12:37:49 +00:00
|
|
|
from trezorlib.tools import parse_path
|
2018-04-16 14:38:00 +00:00
|
|
|
|
2018-08-10 13:24:21 +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.lisk
|
2020-10-26 12:32:03 +00:00
|
|
|
@pytest.mark.parametrize(
|
|
|
|
"path, address",
|
|
|
|
(
|
|
|
|
("m/44h/134h/0h", "3685460048641680438L"),
|
|
|
|
("m/44h/134h/1h", "2178885030141662239L"),
|
|
|
|
("m/44h/134h/100h", "7191894793645699638L"),
|
|
|
|
("m/44h/1h/0h", "8365436719773013410L"),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
def test_lisk_getaddress(client, path, address):
|
|
|
|
address_n = parse_path(path)
|
|
|
|
assert lisk.get_address(client, address_n) == address
|