2018-06-21 14:28:34 +00:00
|
|
|
# This file is part of the Trezor project.
|
2017-05-08 20:15:24 +00:00
|
|
|
#
|
2019-05-29 16:44:09 +00:00
|
|
|
# Copyright (C) 2012-2019 SatoshiLabs and contributors
|
2017-05-08 20:15:24 +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-05-08 20:15:24 +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-05-11 12:53:51 +00:00
|
|
|
import pytest
|
2017-05-08 20:15:24 +00:00
|
|
|
|
2018-08-13 16:21:24 +00:00
|
|
|
from trezorlib import btc, debuglink
|
|
|
|
|
2018-05-11 12:53:51 +00:00
|
|
|
from .common import TrezorTest
|
2017-05-08 20:15:24 +00:00
|
|
|
|
|
|
|
|
2017-12-19 18:24:18 +00:00
|
|
|
@pytest.mark.skip_t2
|
2017-12-23 20:20:49 +00:00
|
|
|
class TestDeviceLoadXprv(TrezorTest):
|
2017-05-08 20:15:24 +00:00
|
|
|
def test_load_device_xprv_1(self):
|
2018-08-13 16:21:24 +00:00
|
|
|
debuglink.load_device_by_xprv(
|
|
|
|
self.client,
|
|
|
|
xprv="xprv9s21ZrQH143K2JF8RafpqtKiTbsbaxEeUaMnNHsm5o6wCW3z8ySyH4UxFVSfZ8n7ESu7fgir8imbZKLYVBxFPND1pniTZ81vKfd45EHKX73",
|
|
|
|
pin="",
|
|
|
|
passphrase_protection=False,
|
|
|
|
label="test",
|
|
|
|
language="english",
|
|
|
|
)
|
2017-05-08 20:15:24 +00:00
|
|
|
|
|
|
|
passphrase_protection = self.client.debug.read_passphrase_protection()
|
2017-12-23 20:20:49 +00:00
|
|
|
assert passphrase_protection is False
|
2017-05-08 20:15:24 +00:00
|
|
|
|
2018-08-13 16:21:24 +00:00
|
|
|
address = btc.get_address(self.client, "Bitcoin", [])
|
|
|
|
assert address == "128RdrAkJDmqasgvfRf6MC5VcX4HKqH4mR"
|
2017-05-08 20:15:24 +00:00
|
|
|
|
|
|
|
def test_load_device_xprv_2(self):
|
2018-08-13 16:21:24 +00:00
|
|
|
debuglink.load_device_by_xprv(
|
|
|
|
self.client,
|
|
|
|
xprv="xprv9s21ZrQH143K2JF8RafpqtKiTbsbaxEeUaMnNHsm5o6wCW3z8ySyH4UxFVSfZ8n7ESu7fgir8imbZKLYVBxFPND1pniTZ81vKfd45EHKX73",
|
|
|
|
pin="",
|
|
|
|
passphrase_protection=True,
|
|
|
|
label="test",
|
|
|
|
language="english",
|
|
|
|
)
|
2017-05-08 20:15:24 +00:00
|
|
|
|
2018-08-13 16:21:24 +00:00
|
|
|
self.client.set_passphrase("passphrase")
|
2017-05-08 20:15:24 +00:00
|
|
|
|
|
|
|
passphrase_protection = self.client.debug.read_passphrase_protection()
|
2017-12-23 20:20:49 +00:00
|
|
|
assert passphrase_protection is True
|
2017-05-08 20:15:24 +00:00
|
|
|
|
2018-08-13 16:21:24 +00:00
|
|
|
address = btc.get_address(self.client, "Bitcoin", [])
|
|
|
|
assert address == "1CHUbFa4wTTPYgkYaw2LHSd5D4qJjMU8ri"
|