From 9bb1cf20559ed7a7b8e825787d9ffa826a99506f Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Thu, 15 Jul 2021 11:29:44 -0400 Subject: [PATCH] Conduct OTP tests --- .../raspberry_pi/tests/otp/otp_test.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 crawler_software/raspberry_pi/tests/otp/otp_test.py diff --git a/crawler_software/raspberry_pi/tests/otp/otp_test.py b/crawler_software/raspberry_pi/tests/otp/otp_test.py new file mode 100644 index 0000000..e77b61d --- /dev/null +++ b/crawler_software/raspberry_pi/tests/otp/otp_test.py @@ -0,0 +1,15 @@ +import time, pyotp + +totp = pyotp.TOTP(pyotp.random_base32()) + +code = totp.now() + +for i in range(0,60): + + if totp.verify(code): + print(f'{code} verified fine at t+{i}') + else: + print(f'{code} expired at t+{i}') + break + + time.sleep(1)