diff options
Diffstat (limited to 'tests/test_generator.py')
| -rw-r--r-- | tests/test_generator.py | 20 |
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 | ||
| 113 | def test_md5(): | 113 | def test_md5(): |
