summaryrefslogtreecommitdiff
path: root/tests/test_generator.py
diff options
context:
space:
mode:
authorSimeon Simeonov2020-03-30 21:57:53 +0200
committerSimeon Simeonov2020-03-30 21:57:53 +0200
commit2a6299c32e0baf3df06f8e6d6bc8695b951d630d (patch)
treeb4bd18092822db0fd10411e49dc6e05d1a60e697 /tests/test_generator.py
parenta4c050e34ce462f477bc3671e272e244e2792e00 (diff)
Implement OTPState in the server module
Diffstat (limited to 'tests/test_generator.py')
-rw-r--r--tests/test_generator.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/test_generator.py b/tests/test_generator.py
index 74fc3a4..50274e2 100644
--- a/tests/test_generator.py
+++ b/tests/test_generator.py
@@ -62,16 +62,6 @@ def test_constructor_exceptions():
62 """ 62 """
63 # test the otp2289.OTPGenerator __init__ and validators 63 # test the otp2289.OTPGenerator __init__ and validators
64 with pytest.raises(otp2289.OTPGeneratorException) as exc_info: 64 with pytest.raises(otp2289.OTPGeneratorException) as exc_info:
65 otp2289.OTPGenerator('1234567', 'TeStø'.encode(), otp2289.OTP_ALGO_MD5)
66 assert exc_info.type is otp2289.OTPGeneratorException
67 assert exc_info.value.args[0] == 'Password must be a byte-string'
68 with pytest.raises(otp2289.OTPGeneratorException) as exc_info:
69 otp2289.OTPGenerator('1234567'.encode(),
70 'TeStø'.encode(),
71 otp2289.OTP_ALGO_MD5)
72 assert exc_info.type is otp2289.OTPGeneratorException
73 assert exc_info.value.args[0] == 'Password must be longer than 10 bytes'
74 with pytest.raises(otp2289.OTPGeneratorException) as exc_info:
75 otp2289.OTPGenerator('This is a test.'.encode(), 65 otp2289.OTPGenerator('This is a test.'.encode(),
76 'TeStø'.encode(), 66 'TeStø'.encode(),
77 otp2289.OTP_ALGO_MD5) 67 otp2289.OTP_ALGO_MD5)
@@ -108,6 +98,16 @@ def test_constructor_exceptions():
108 assert exc_info.type is otp2289.generator.OTPGeneratorException 98 assert exc_info.type is otp2289.generator.OTPGeneratorException
109 assert exc_info.value.args[0] == ('foo is not supported by this version ' 99 assert exc_info.value.args[0] == ('foo is not supported by this version '
110 'of the hashlib module') 100 'of the hashlib module')
101 with pytest.raises(otp2289.OTPGeneratorException) as exc_info:
102 otp2289.OTPGenerator('1234567', 'TeSt', otp2289.OTP_ALGO_MD5)
103 assert exc_info.type is otp2289.OTPGeneratorException
104 assert exc_info.value.args[0] == 'Password must be a byte-string'
105 with pytest.raises(otp2289.OTPGeneratorException) as exc_info:
106 otp2289.OTPGenerator('1234567'.encode(),
107 'TeSt',
108 otp2289.OTP_ALGO_MD5)
109 assert exc_info.type is otp2289.OTPGeneratorException
110 assert exc_info.value.args[0] == 'Password must be longer than 10 bytes'
111 111
112 112
113def test_md5(): 113def test_md5():