1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-26 09:28:13 +00:00
trezor-firmware/core/tests/test_apps.common.storage.py
Tomas Susanka 46e4c02602 core: refactor storage
Each namespace now has its own file in apps.common.storage and
storage/__init__ serves as an entry point.

Updates #274.
2019-07-08 15:24:56 +02:00

25 lines
679 B
Python

from common import *
from trezor.pin import pin_to_int
from trezor import config
from apps.common.storage import device
class TestConfig(unittest.TestCase):
def test_counter(self):
config.init()
config.wipe()
for i in range(150):
self.assertEqual(device.next_u2f_counter(), i)
device.set_u2f_counter(350)
for i in range(351, 500):
self.assertEqual(device.next_u2f_counter(), i)
device.set_u2f_counter(0)
self.assertEqual(device.next_u2f_counter(), 1)
device.set_u2f_counter(None)
self.assertEqual(device.next_u2f_counter(), 0)
if __name__ == '__main__':
unittest.main()