From bfae04723bd3155801f079ab5238018ec8a0cb09 Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Fri, 1 May 2026 14:34:04 +0200 Subject: Redesign API by introducing otp2289.OTPResponse type --- tests/test_static.py | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'tests/test_static.py') diff --git a/tests/test_static.py b/tests/test_static.py index 589fc17..7268e84 100644 --- a/tests/test_static.py +++ b/tests/test_static.py @@ -32,58 +32,58 @@ import otp2289 def test_bytes_and_tokens() -> None: """Tests the official hex and tokens defined in RFC2289""" assert bytes.fromhex('9e876134d90499dd') == ( - otp2289.OTPGenerator.tokens_to_bytes('INCH SEA ANNE LONG AHEM TOUR') + otp2289.OTPResponse.tokens_to_bytes('INCH SEA ANNE LONG AHEM TOUR') ) assert bytes.fromhex('7965e05436f5029f') == ( - otp2289.OTPGenerator.tokens_to_bytes('EASE OIL FUM CURE AWRY AVIS') + otp2289.OTPResponse.tokens_to_bytes('EASE OIL FUM CURE AWRY AVIS') ) assert bytes.fromhex('50fe1962c4965880') == ( - otp2289.OTPGenerator.tokens_to_bytes('BAIL TUFT BITS GANG CHEF THY') + otp2289.OTPResponse.tokens_to_bytes('BAIL TUFT BITS GANG CHEF THY') ) assert bytes.fromhex('87066dd9644bf206') == ( - otp2289.OTPGenerator.tokens_to_bytes('FULL PEW DOWN ONCE MORT ARC') + otp2289.OTPResponse.tokens_to_bytes('FULL PEW DOWN ONCE MORT ARC') ) assert bytes.fromhex('7cd34c1040add14b') == ( - otp2289.OTPGenerator.tokens_to_bytes('FACT HOOF AT FIST SITE KENT') + otp2289.OTPResponse.tokens_to_bytes('FACT HOOF AT FIST SITE KENT') ) assert bytes.fromhex('5aa37a81f212146c') == ( - otp2289.OTPGenerator.tokens_to_bytes('BODE HOP JAKE STOW JUT RAP') + otp2289.OTPResponse.tokens_to_bytes('BODE HOP JAKE STOW JUT RAP') ) assert bytes.fromhex('f205753943de4cf9') == ( - otp2289.OTPGenerator.tokens_to_bytes('ULAN NEW ARMY FUSE SUIT EYED') + otp2289.OTPResponse.tokens_to_bytes('ULAN NEW ARMY FUSE SUIT EYED') ) assert bytes.fromhex('ddcdac956f234937') == ( - otp2289.OTPGenerator.tokens_to_bytes('SKIM CULT LOB SLAM POE HOWL') + otp2289.OTPResponse.tokens_to_bytes('SKIM CULT LOB SLAM POE HOWL') ) assert bytes.fromhex('b203e28fa525be47') == ( - otp2289.OTPGenerator.tokens_to_bytes('LONG IVY JULY AJAR BOND LEE') + otp2289.OTPResponse.tokens_to_bytes('LONG IVY JULY AJAR BOND LEE') ) assert bytes.fromhex('bb9e6ae1979d8ff4') == ( - otp2289.OTPGenerator.tokens_to_bytes('MILT VARY MAST OK SEES WENT') + otp2289.OTPResponse.tokens_to_bytes('MILT VARY MAST OK SEES WENT') ) assert bytes.fromhex('63d936639734385b') == ( - otp2289.OTPGenerator.tokens_to_bytes('CART OTTO HIVE ODE VAT NUT') + otp2289.OTPResponse.tokens_to_bytes('CART OTTO HIVE ODE VAT NUT') ) assert bytes.fromhex('87fec7768b73ccf9') == ( - otp2289.OTPGenerator.tokens_to_bytes('GAFF WAIT SKID GIG SKY EYED') + otp2289.OTPResponse.tokens_to_bytes('GAFF WAIT SKID GIG SKY EYED') ) assert bytes.fromhex('ad85f658ebe383c9') == ( - otp2289.OTPGenerator.tokens_to_bytes('LEST OR HEEL SCOT ROB SUIT') + otp2289.OTPResponse.tokens_to_bytes('LEST OR HEEL SCOT ROB SUIT') ) assert bytes.fromhex('d07ce229b5cf119b') == ( - otp2289.OTPGenerator.tokens_to_bytes('RITE TAKE GELD COST TUNE RECK') + otp2289.OTPResponse.tokens_to_bytes('RITE TAKE GELD COST TUNE RECK') ) assert bytes.fromhex('27bc71035aaf3dc6') == ( - otp2289.OTPGenerator.tokens_to_bytes('MAY STAR TIN LYON VEDA STAN') + otp2289.OTPResponse.tokens_to_bytes('MAY STAR TIN LYON VEDA STAN') ) assert bytes.fromhex('d51f3e99bf8e6f0b') == ( - otp2289.OTPGenerator.tokens_to_bytes('RUST WELT KICK FELL TAIL FRAU') + otp2289.OTPResponse.tokens_to_bytes('RUST WELT KICK FELL TAIL FRAU') ) assert bytes.fromhex('82aeb52d943774e4') == ( - otp2289.OTPGenerator.tokens_to_bytes('FLIT DOSE ALSO MEW DRUM DEFY') + otp2289.OTPResponse.tokens_to_bytes('FLIT DOSE ALSO MEW DRUM DEFY') ) assert bytes.fromhex('4f296a74fe1567ec') == ( - otp2289.OTPGenerator.tokens_to_bytes('AURA ALOE HURL WING BERG WAIT') + otp2289.OTPResponse.tokens_to_bytes('AURA ALOE HURL WING BERG WAIT') ) @@ -92,4 +92,4 @@ def test_random_bytes() -> None: for _ in range(10): rnd_bytes = os.urandom(8) # 64 bits tokens = otp2289.OTPResponse.bytes_to_tokens(rnd_bytes) - assert rnd_bytes == otp2289.OTPGenerator.tokens_to_bytes(tokens) + assert rnd_bytes == otp2289.OTPResponse.tokens_to_bytes(tokens) -- cgit v1.3