From 1fed3fd903da061a58d846f92161b60b711d8df5 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Sat, 22 Jun 2019 17:05:04 +0200 Subject: Collect received OTP codes for all slots and print them Signed-off-by: Szczepan Zalega --- unittest/test_pro.py | 15 ++++++++++++--- 1 file 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 -- cgit v1.2.3