2018-12-29 21:33:19 +00:00
|
|
|
from common import *
|
|
|
|
from trezor import config
|
2019-10-31 15:34:16 +00:00
|
|
|
from storage import device
|
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
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
unittest.main()
|