You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.6 KiB
49 lines
1.6 KiB
6 years ago
|
# This file is part of the Trezor project.
|
||
8 years ago
|
#
|
||
6 years ago
|
# Copyright (C) 2012-2018 SatoshiLabs and contributors
|
||
8 years ago
|
#
|
||
|
# This library is free software: you can redistribute it and/or modify
|
||
6 years ago
|
# it under the terms of the GNU Lesser General Public License version 3
|
||
|
# as published by the Free Software Foundation.
|
||
8 years ago
|
#
|
||
|
# 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.
|
||
|
#
|
||
6 years ago
|
# 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>.
|
||
|
|
||
6 years ago
|
import pytest
|
||
8 years ago
|
|
||
7 years ago
|
from trezorlib import messages as proto
|
||
7 years ago
|
|
||
6 years ago
|
from .common import TrezorTest
|
||
|
|
||
11 years ago
|
|
||
7 years ago
|
@pytest.mark.skip_t2
|
||
7 years ago
|
class TestDebuglink(TrezorTest):
|
||
11 years ago
|
def test_layout(self):
|
||
6 years ago
|
layout = self.client.debug.state().layout
|
||
7 years ago
|
assert len(layout) == 1024
|
||
11 years ago
|
|
||
|
def test_mnemonic(self):
|
||
6 years ago
|
self.setup_mnemonic_nopin_nopassphrase(lock=False)
|
||
6 years ago
|
mnemonic = self.client.debug.state().mnemonic_secret
|
||
|
assert mnemonic == self.mnemonic12.encode()
|
||
11 years ago
|
|
||
11 years ago
|
def test_pin(self):
|
||
|
self.setup_mnemonic_pin_passphrase()
|
||
|
|
||
|
# Manually trigger PinMatrixRequest
|
||
6 years ago
|
resp = self.client.call_raw(proto.Ping(message="test", pin_protection=True))
|
||
7 years ago
|
assert isinstance(resp, proto.PinMatrixRequest)
|
||
11 years ago
|
|
||
6 years ago
|
pin, matrix = self.client.debug.read_pin()
|
||
|
assert pin == "1234"
|
||
|
assert matrix != ""
|
||
11 years ago
|
|
||
|
pin_encoded = self.client.debug.read_pin_encoded()
|
||
|
resp = self.client.call_raw(proto.PinMatrixAck(pin=pin_encoded))
|
||
7 years ago
|
assert isinstance(resp, proto.Success)
|