aboutsummaryrefslogtreecommitdiff
path: root/unittest
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2019-06-22 17:05:04 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2019-06-22 17:31:16 +0200
commit1fed3fd903da061a58d846f92161b60b711d8df5 (patch)
tree578e349f9e5b44acabf106e3f8f8f2073a80ad02 /unittest
parent926909f7dfdf5620a28a1600a173d8b0e2041bc2 (diff)
downloadlibnitrokey-1fed3fd903da061a58d846f92161b60b711d8df5.tar.gz
libnitrokey-1fed3fd903da061a58d846f92161b60b711d8df5.tar.bz2
Collect received OTP codes for all slots and print them
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest')
-rw-r--r--unittest/test_pro.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/unittest/test_pro.py b/unittest/test_pro.py
index 15c23b4..29eabff 100644
--- a/unittest/test_pro.py
+++ b/unittest/test_pro.py
@@ -1062,22 +1062,31 @@ def test_edge_OTP_slots(C):
def test_OTP_all_rw(C):
"""
- Write all OTP slots and read codes from them two times
+ Write all OTP slots and read codes from them two times.
+ All generated codes should be the same, which is checked as well.
"""
for i in range(TOTP_slot_count):
helper_set_TOTP_test_slot(C, i)
for i in range(HOTP_slot_count):
helper_set_HOTP_test_slot(C, i)
- for i in range(2):
+ all_codes = []
+ for i in range(5):
+ this_loop_codes = []
code_old = b''
+ helper_set_time_on_device(C, 30*i)
for i in range(TOTP_slot_count):
code = helper_get_TOTP_code(C, i)
if code_old:
assert code == code_old
code_old = code
+ this_loop_codes.append(('T', i, code))
code_old = b''
for i in range(HOTP_slot_count):
code = helper_get_HOTP_code(C, i)
if code_old:
assert code == code_old
- code_old = code \ No newline at end of file
+ code_old = code
+ this_loop_codes.append(('H', i, code))
+ all_codes.append(this_loop_codes)
+ from pprint import pprint
+ pprint(all_codes) \ No newline at end of file