1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-13 02:58:57 +00:00
trezor-firmware/src/tests/test_trezor.config.py

30 lines
809 B
Python
Raw Normal View History

import sys
sys.path.append('..')
sys.path.append('../lib')
import unittest
from trezor import config
from trezor.crypto import random
class TestConfig(unittest.TestCase):
def test_set_get(self):
config.wipe()
for _ in range(128):
appid, key = random.uniform(256), random.uniform(256)
value = random.bytes(128)
config.set(appid, key, value)
value2 = config.get(appid, key)
self.assertEqual(value, value2)
def test_get_default(self):
config.wipe()
for _ in range(128):
appid, key = random.uniform(256), random.uniform(256)
value = random.bytes(128)
value2 = config.get(appid, key, value)
self.assertEqual(value, value2)
if __name__ == '__main__':
unittest.main()