@@ -65,7 +65,7 @@ def test_with_expired_signature(
6565 ):
6666 validator = TokenValidator ()
6767 assert validator (Mock (headers = {"Authorization" : "Bearer abc123" })) is None
68- mock_logger .error .assert_called_with ("Token is expired" , exc_info = True )
68+ mock_logger .exception .assert_called_with ("Token is expired" )
6969
7070 @patch (
7171 f"{ TokenValidator .__module__ } .jwt.decode" , side_effect = jwt .InvalidAudienceError
@@ -75,8 +75,8 @@ def test_with_invalid_claims(
7575 ):
7676 validator = TokenValidator ()
7777 assert validator (Mock (headers = {"Authorization" : "Bearer abc123" })) is None
78- mock_logger .error .assert_called_with (
79- "Invalid claims. Please check the audience and issuer." , exc_info = True
78+ mock_logger .exception .assert_called_with (
79+ "Invalid claims. Please check the audience and issuer."
8080 )
8181
8282 @patch (
@@ -87,8 +87,8 @@ def test_with_invalid_issuer(
8787 ):
8888 validator = TokenValidator ()
8989 assert validator (Mock (headers = {"Authorization" : "Bearer abc123" })) is None
90- mock_logger .error .assert_called_with (
91- "Invalid claims. Please check the audience and issuer." , exc_info = True
90+ mock_logger .exception .assert_called_with (
91+ "Invalid claims. Please check the audience and issuer."
9292 )
9393
9494 @patch (f"{ TokenValidator .__module__ } .jwt.decode" , side_effect = jwt .InvalidTokenError )
@@ -97,16 +97,16 @@ def test_with_invalid_token(
9797 ):
9898 validator = TokenValidator ()
9999 assert validator (Mock (headers = {"Authorization" : "Bearer abc123" })) is None
100- mock_logger .error .assert_called_with ("Token is invalid" , exc_info = True )
100+ mock_logger .exception .assert_called_with ("Token is invalid" )
101101
102102 @patch (f"{ TokenValidator .__module__ } .jwt.decode" , side_effect = Exception )
103103 def test_with_unexpected_exception (
104104 self , mock_jwt_decode , mock_logger , mock_get_unverified_header , mock_urlopen
105105 ):
106106 validator = TokenValidator ()
107107 assert validator (Mock (headers = {"Authorization" : "Bearer abc123" })) is None
108- mock_logger .error .assert_called_with (
109- "Unable to parse authentication token." , exc_info = True
108+ mock_logger .exception .assert_called_with (
109+ "Unable to parse authentication token."
110110 )
111111
112112 @patch (
0 commit comments