1# This file is part of the TREZOR project. 2# 3# Copyright (C) 2012-2016 Marek Palatinus <slush@satoshilabs.com> 4# Copyright (C) 2012-2016 Pavol Rusnak <stick@satoshilabs.com> 5# 6# This library is free software: you can redistribute it and/or modify 7# it under the terms of the GNU Lesser General Public License as published by 8# the Free Software Foundation, either version 3 of the License, or 9# (at your option) any later version. 10# 11# This library is distributed in the hope that it will be useful, 12# but WITHOUT ANY WARRANTY; without even the implied warranty of 13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14# GNU Lesser General Public License for more details. 15# 16# You should have received a copy of the GNU Lesser General Public License 17# along with this library. If not, see <http://www.gnu.org/licenses/>. 18# 19# The script has been modified for KeepKey Device. 20 21import unittest 22import common 23 24from keepkeylib import messages_pb2 as messages 25 26class TestBasic(common.KeepKeyTest): 27 28 def test_features(self): 29 features = self.client.call(messages.Initialize()) 30 self.assertEqual(features, self.client.features) 31 32 def test_ping(self): 33 ping = self.client.call(messages.Ping(message='ahoj!')) 34 self.assertEqual(ping, messages.Success(message='ahoj!')) 35 36 def test_device_id_same(self): 37 id1 = self.client.get_device_id() 38 self.client.init_device() 39 id2 = self.client.get_device_id() 40 41 # ID must be at least 12 characters 42 self.assertTrue(len(id1) >= 12) 43 44 # Every resulf of UUID must be the same 45 self.assertEqual(id1, id2) 46 47if __name__ == '__main__': 48 unittest.main() 49