From 2a6299c32e0baf3df06f8e6d6bc8695b951d630d Mon Sep 17 00:00:00 2001 From: Simeon Simeonov Date: Mon, 30 Mar 2020 21:57:53 +0200 Subject: Implement OTPState in the server module --- tests/test_generator.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'tests/test_generator.py') 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 @@ -61,16 +61,6 @@ def test_constructor_exceptions(): Tests the exceptions when initializing a new object (in the constructor) """ # test the otp2289.OTPGenerator __init__ and validators - with pytest.raises(otp2289.OTPGeneratorException) as exc_info: - otp2289.OTPGenerator('1234567', 'TeStø'.encode(), otp2289.OTP_ALGO_MD5) - assert exc_info.type is otp2289.OTPGeneratorException - assert exc_info.value.args[0] == 'Password must be a byte-string' - with pytest.raises(otp2289.OTPGeneratorException) as exc_info: - otp2289.OTPGenerator('1234567'.encode(), - 'TeStø'.encode(), - otp2289.OTP_ALGO_MD5) - assert exc_info.type is otp2289.OTPGeneratorException - assert exc_info.value.args[0] == 'Password must be longer than 10 bytes' with pytest.raises(otp2289.OTPGeneratorException) as exc_info: otp2289.OTPGenerator('This is a test.'.encode(), 'TeStø'.encode(), @@ -108,6 +98,16 @@ def test_constructor_exceptions(): assert exc_info.type is otp2289.generator.OTPGeneratorException assert exc_info.value.args[0] == ('foo is not supported by this version ' 'of the hashlib module') + with pytest.raises(otp2289.OTPGeneratorException) as exc_info: + otp2289.OTPGenerator('1234567', 'TeSt', otp2289.OTP_ALGO_MD5) + assert exc_info.type is otp2289.OTPGeneratorException + assert exc_info.value.args[0] == 'Password must be a byte-string' + with pytest.raises(otp2289.OTPGeneratorException) as exc_info: + otp2289.OTPGenerator('1234567'.encode(), + 'TeSt', + otp2289.OTP_ALGO_MD5) + assert exc_info.type is otp2289.OTPGeneratorException + assert exc_info.value.args[0] == 'Password must be longer than 10 bytes' def test_md5(): -- cgit v1.3