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.
50 lines
1.6 KiB
50 lines
1.6 KiB
6 years ago
|
# This file is part of the Trezor project.
|
||
7 years ago
|
#
|
||
6 years ago
|
# Copyright (C) 2012-2018 SatoshiLabs and contributors
|
||
7 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.
|
||
7 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>.
|
||
7 years ago
|
|
||
6 years ago
|
from trezorlib import device, messages
|
||
12 years ago
|
|
||
6 years ago
|
from .common import TrezorTest
|
||
12 years ago
|
|
||
7 years ago
|
|
||
7 years ago
|
class TestBasic(TrezorTest):
|
||
12 years ago
|
def test_features(self):
|
||
6 years ago
|
f0 = self.client.features
|
||
|
f1 = self.client.call(messages.Initialize())
|
||
|
assert f0 == f1
|
||
10 years ago
|
|
||
12 years ago
|
def test_ping(self):
|
||
6 years ago
|
ping = self.client.call(messages.Ping(message="ahoj!"))
|
||
|
assert ping == messages.Success(message="ahoj!")
|
||
10 years ago
|
|
||
10 years ago
|
def test_device_id_same(self):
|
||
|
id1 = self.client.get_device_id()
|
||
11 years ago
|
self.client.init_device()
|
||
10 years ago
|
id2 = self.client.get_device_id()
|
||
10 years ago
|
|
||
10 years ago
|
# ID must be at least 12 characters
|
||
7 years ago
|
assert len(id1) >= 12
|
||
10 years ago
|
|
||
12 years ago
|
# Every resulf of UUID must be the same
|
||
7 years ago
|
assert id1 == id2
|
||
10 years ago
|
|
||
|
def test_device_id_different(self):
|
||
|
id1 = self.client.get_device_id()
|
||
6 years ago
|
device.wipe(self.client)
|
||
10 years ago
|
id2 = self.client.get_device_id()
|
||
|
|
||
|
# Device ID must be fresh after every reset
|
||
7 years ago
|
assert id1 != id2
|