diff --git a/tests/test.py b/tests/test.py deleted file mode 100755 index 08055d891..000000000 --- a/tests/test.py +++ /dev/null @@ -1,54 +0,0 @@ -#!/usr/bin/python -''' - -TODO: - -x ApplySettings -x ChangePin -x Ping -x GetEntropy -x GetPublicKey -x GetAddress -x WipeDevice -x LoadDevice -x ResetDevice -x RecoveryDevice -x SignMessage -x VerifyMessage -x EstimateTxSize -- SignTx -x SimpleSignTx -- FirmwareErase -- FirmwareUpload - -x protection levels -x neuspesna zmena pinu - -pin backoff predelat pred zadanim pinu - -- zrejme v sucinnosti s inymi testami - x ButtonRequest/ButtonAck workflow - x PinMatrixRequest/PinMatrixAck workflow - x PassphraseRequest/PassphraseAck workflow - -- rozsirit test_sign.tx o viac transakcii (zlozitejsich) - x fee over threshold - x not enough funds - x viac ako jeden vstup a jeden vystup - x iny cointype ako 0 - -- chceme v tomto release(?) - x SignMessage workflow - x VerifyMessage workflow - -otestovat session handling (tento test bude zrejme failovat na RPi) -Failure_NotInitialized -Features reflects all variations of LoadDevice - -x Zero signature test - -x test bip39, utf, passphrase -x Clear session on ChangePin - -Test s invalid adresou pro vystup -''' diff --git a/tests/test_protect_call.py b/tests/test_protect_call.py index 3ce98c68b..fbe67fcda 100644 --- a/tests/test_protect_call.py +++ b/tests/test_protect_call.py @@ -9,6 +9,7 @@ from trezorlib.client import PinException, CallException # FIXME TODO Add passphrase tests class TestProtectCall(common.TrezorTest): + def _some_protected_call(self, button, pin, passphrase): # This method perform any call which have protection in the device res = self.client.ping('random data', @@ -17,6 +18,7 @@ class TestProtectCall(common.TrezorTest): passphrase_protection=passphrase) self.assertEqual(res, 'random data') + """ def test_expected_responses(self): self.setup_mnemonic_pin_passphrase() @@ -57,6 +59,7 @@ class TestProtectCall(common.TrezorTest): proto.Success(message='wrong data')]) self._some_protected_call(True, True, True) self.assertRaises(CallException, scenario5) + """ def test_no_protection(self): self.setup_mnemonic_nopin_nopassphrase() @@ -93,36 +96,17 @@ class TestProtectCall(common.TrezorTest): self.client.setup_debuglink(button=True, pin_correct=False) def test_backoff(attempts, start): - expected = 1.8 ** attempts + expected = 0.2 * (2 ** attempts) got = time.time() - start msg = "Pin delay expected to be at least %s seconds, got %s" % (expected, got) print msg self.assertLessEqual(expected, got, msg) - for attempt in range(1, 4): + for attempt in range(1, 6): start = time.time() self.assertRaises(PinException, self._some_protected_call, False, True, False) test_backoff(attempt, start) -''' - # Unplug Trezor now - self.client.debuglink.stop() - self.client.close() - - # Give it some time to reboot (it may take some time on RPi) - boot_delay = 20 - time.sleep(boot_delay) - - # Connect to Trezor again - start = time.time() - self.setUp() - expected = 1.8 ** attempt / 2 # This test isn't accurate, let's expect at least some delay - took = time.time() - start - print "Expected reboot time at least %s seconds" % expected - print "Rebooted in %s seconds" % took - self.assertLessEqual(expected, time.time() - start, "Bootup took %s seconds, expected %s seconds or more!" % (took, expected)) - ''' - if __name__ == '__main__': unittest.main() diff --git a/tests/test_protection_levels.py b/tests/test_protection_levels.py index 26a76410e..e92948893 100644 --- a/tests/test_protection_levels.py +++ b/tests/test_protection_levels.py @@ -75,8 +75,9 @@ class TestProtectionLevels(common.TrezorTest): def test_load_device(self): with self.client: - self.client.set_expected_responses([proto.Success(), - proto.Features()]) + self.client.set_expected_responses([proto.ButtonRequest(), + proto.Success(), + proto.Features()]) self.client.load_device_by_mnemonic('this is mnemonic', '1234', True, 'label', 'english', skip_checksum=True) # This must fail, because device is already initialized