1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-28 17:18:29 +00:00
trezor-firmware/tests/device_tests/test_msg_loaddevice_xprv.py

59 lines
2.1 KiB
Python
Raw Normal View History

# This file is part of the Trezor project.
#
2019-05-29 16:44:09 +00:00
# Copyright (C) 2012-2019 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# 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.
#
# 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>.
import pytest
2018-08-13 16:21:24 +00:00
from trezorlib import btc, debuglink
@pytest.mark.skip_t2
2019-09-11 12:29:39 +00:00
class TestDeviceLoadXprv:
@pytest.mark.setup_client(uninitialized=True)
def test_load_device_xprv_1(self, client):
2018-08-13 16:21:24 +00:00
debuglink.load_device_by_xprv(
client,
2018-08-13 16:21:24 +00:00
xprv="xprv9s21ZrQH143K2JF8RafpqtKiTbsbaxEeUaMnNHsm5o6wCW3z8ySyH4UxFVSfZ8n7ESu7fgir8imbZKLYVBxFPND1pniTZ81vKfd45EHKX73",
pin="",
passphrase_protection=False,
label="test",
language="english",
)
passphrase_protection = client.debug.read_passphrase_protection()
assert passphrase_protection is False
address = btc.get_address(client, "Bitcoin", [])
2018-08-13 16:21:24 +00:00
assert address == "128RdrAkJDmqasgvfRf6MC5VcX4HKqH4mR"
@pytest.mark.setup_client(uninitialized=True)
def test_load_device_xprv_2(self, client):
2018-08-13 16:21:24 +00:00
debuglink.load_device_by_xprv(
client,
2018-08-13 16:21:24 +00:00
xprv="xprv9s21ZrQH143K2JF8RafpqtKiTbsbaxEeUaMnNHsm5o6wCW3z8ySyH4UxFVSfZ8n7ESu7fgir8imbZKLYVBxFPND1pniTZ81vKfd45EHKX73",
pin="",
passphrase_protection=True,
label="test",
language="english",
)
client.set_passphrase("passphrase")
passphrase_protection = client.debug.read_passphrase_protection()
assert passphrase_protection is True
address = btc.get_address(client, "Bitcoin", [])
2018-08-13 16:21:24 +00:00
assert address == "1CHUbFa4wTTPYgkYaw2LHSd5D4qJjMU8ri"