summaryrefslogtreecommitdiff
path: root/test/test_server.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_server.py')
-rw-r--r--test/test_server.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/test/test_server.py b/test/test_server.py
index 64e7f67..e81532f 100644
--- a/test/test_server.py
+++ b/test/test_server.py
@@ -1,7 +1,6 @@
1# -*- coding: utf-8 -*-
2# SPDX-License-Identifier: BSD-2-Clause-FreeBSD 1# SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3# 2#
4# Copyright (c) 2020-2023, Simeon Simeonov 3# Copyright (c) 2020-2025, Simeon Simeonov
5# All rights reserved. 4# All rights reserved.
6# 5#
7# Redistribution and use in source and binary forms, with or without 6# Redistribution and use in source and binary forms, with or without
@@ -39,9 +38,9 @@ def test_state_caller_exceptions():
39 'TeSt', 38 'TeSt',
40 otp2289.OTP_ALGO_MD5, 39 otp2289.OTP_ALGO_MD5,
41 ) 40 )
42 with pytest.raises(otp2289.OTPInvalidResponse) as exc_info: 41 with pytest.raises(otp2289.OTPInvalidResponseError) as exc_info:
43 state.response_validates('bla') 42 state.response_validates('bla')
44 assert exc_info.type is otp2289.OTPInvalidResponse 43 assert exc_info.type is otp2289.OTPInvalidResponseError
45 assert exc_info.value.args[0] == ( 44 assert exc_info.value.args[0] == (
46 'The response is neither a valid token or hex' 45 'The response is neither a valid token or hex'
47 ) 46 )
@@ -49,23 +48,23 @@ def test_state_caller_exceptions():
49 48
50def test_state_constructor_exceptions(): 49def test_state_constructor_exceptions():
51 """Tests the exceptions when initializing new OTPState objects""" 50 """Tests the exceptions when initializing new OTPState objects"""
52 with pytest.raises(otp2289.OTPStateException) as exc_info: 51 with pytest.raises(otp2289.OTPStateError) as exc_info:
53 otp2289.OTPState( 52 otp2289.OTPState(
54 '0x7965e05436f5029t', 53 '0x7965e05436f5029t',
55 1, 54 1,
56 'TeStø'.encode(), 55 'TeStø'.encode(),
57 otp2289.OTP_ALGO_MD5, 56 otp2289.OTP_ALGO_MD5,
58 ) 57 )
59 assert exc_info.type is otp2289.OTPStateException 58 assert exc_info.type is otp2289.OTPStateError
60 assert exc_info.value.args[0] == 'Seed must be a string' 59 assert exc_info.value.args[0] == 'Seed must be a string'
61 with pytest.raises(otp2289.OTPStateException) as exc_info: 60 with pytest.raises(otp2289.OTPStateError) as exc_info:
62 otp2289.OTPState( 61 otp2289.OTPState(
63 '0x7965e05436f5029t', 62 '0x7965e05436f5029t',
64 '1', 63 '1',
65 'TeSt', 64 'TeSt',
66 otp2289.OTP_ALGO_MD5, 65 otp2289.OTP_ALGO_MD5,
67 ) 66 )
68 assert exc_info.type is otp2289.OTPStateException 67 assert exc_info.type is otp2289.OTPStateError
69 assert exc_info.value.args[0] == 'Step value MUST be an int' 68 assert exc_info.value.args[0] == 'Step value MUST be an int'
70 69
71 70