mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-28 23:32:05 +00:00
chore(core/tests): add smoke test for libtropic
[no changelog]
This commit is contained in:
parent
3c707d2063
commit
aee16c2df7
@ -16,10 +16,10 @@ from trezorutils import ( # noqa: F401
|
||||
USE_BUTTON,
|
||||
USE_HAPTIC,
|
||||
USE_OPTIGA,
|
||||
USE_TROPIC,
|
||||
USE_SD_CARD,
|
||||
USE_THP,
|
||||
USE_TOUCH,
|
||||
USE_TROPIC,
|
||||
VERSION,
|
||||
bootloader_locked,
|
||||
check_firmware_header,
|
||||
|
27
core/tests/test_trezor.crypto.tropic.py
Normal file
27
core/tests/test_trezor.crypto.tropic.py
Normal file
@ -0,0 +1,27 @@
|
||||
import unittest
|
||||
|
||||
from trezor.crypto import tropic
|
||||
|
||||
|
||||
class TestCryptoTropic(unittest.TestCase):
|
||||
def test_ping(self):
|
||||
self.assertEqual(tropic.ping("HeLlO!"), "HeLlO!")
|
||||
|
||||
def test_get_certificate(self):
|
||||
self.assertEqual(len(tropic.get_certificate()), 512)
|
||||
|
||||
def test_sign(self):
|
||||
try:
|
||||
tropic.sign(0, "ASD")
|
||||
assert False
|
||||
except ValueError as e:
|
||||
self.assertIn("invalid length", str(e).lower())
|
||||
|
||||
tropic.key_generate(0)
|
||||
|
||||
# signing should work now that we have a key
|
||||
self.assertEqual(len(tropic.sign(0, "a" * 32)), 64)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
Loading…
Reference in New Issue
Block a user