2024-01-26 11:16:55 +00:00
|
|
|
from common import * # isort:skip
|
2023-06-28 10:58:54 +00:00
|
|
|
|
2019-10-31 15:34:16 +00:00
|
|
|
from storage import device
|
2023-06-28 10:58:54 +00:00
|
|
|
from trezor import config
|
2018-12-29 21:33:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
class TestConfig(unittest.TestCase):
|
|
|
|
def test_counter(self):
|
|
|
|
config.init()
|
|
|
|
config.wipe()
|
|
|
|
for i in range(150):
|
2019-07-01 07:45:30 +00:00
|
|
|
self.assertEqual(device.next_u2f_counter(), i)
|
|
|
|
device.set_u2f_counter(350)
|
2018-12-29 21:33:19 +00:00
|
|
|
for i in range(351, 500):
|
2019-07-01 07:45:30 +00:00
|
|
|
self.assertEqual(device.next_u2f_counter(), i)
|
|
|
|
device.set_u2f_counter(0)
|
|
|
|
self.assertEqual(device.next_u2f_counter(), 1)
|
2018-12-29 21:33:19 +00:00
|
|
|
|
|
|
|
|
2023-06-28 10:46:29 +00:00
|
|
|
if __name__ == "__main__":
|
2018-12-29 21:33:19 +00:00
|
|
|
unittest.main()
|