2018-06-21 14:28:34 +00:00
|
|
|
# This file is part of the Trezor project.
|
2018-04-16 15:31:11 +00:00
|
|
|
#
|
2019-05-29 16:44:09 +00:00
|
|
|
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
2018-04-16 15:31:11 +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 15:31:11 +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 15:31:11 +00:00
|
|
|
|
2018-04-18 13:46:10 +00:00
|
|
|
import pytest
|
2018-04-16 15:31:11 +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 15:31:11 +00:00
|
|
|
|
2019-08-27 14:58:59 +00:00
|
|
|
from .common import MNEMONIC12, TrezorTest
|
2018-08-13 16:21:24 +00:00
|
|
|
|
2018-08-10 12:37:49 +00:00
|
|
|
LISK_PATH = parse_path("m/44h/134h/0h/0h")
|
2018-04-18 13:46:10 +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
|
2018-04-16 15:31:11 +00:00
|
|
|
class TestMsgLiskGetPublicKey(TrezorTest):
|
2019-08-27 14:58:59 +00:00
|
|
|
@pytest.mark.setup_client(mnemonic=MNEMONIC12)
|
|
|
|
def test_lisk_get_public_key(self, client):
|
|
|
|
sig = lisk.get_public_key(client, LISK_PATH)
|
2018-08-13 16:21:24 +00:00
|
|
|
assert (
|
2018-09-14 10:23:38 +00:00
|
|
|
sig.public_key.hex()
|
|
|
|
== "eb56d7bbb5e8ea9269405f7a8527fe126023d1db2c973cfac6f760b60ae27294"
|
2018-08-13 16:21:24 +00:00
|
|
|
)
|