diff --git a/tests/unit/test_auth_service.py b/tests/unit/test_auth_service.py index 2f2ec34da..40f1744c2 100755 --- a/tests/unit/test_auth_service.py +++ b/tests/unit/test_auth_service.py @@ -12,10 +12,14 @@ import pytest import jwt as pyjwt from jwt.exceptions import ExpiredSignatureError, InvalidTokenError -from packages.application.auth.password_hasher import PasswordHasher, PasswordValidator, password_hasher, password_validator +from packages.application.auth.password_hasher import ( + PasswordHasher, + PasswordValidator, + password_hasher, + password_validator, +) from packages.application.auth.jwt_service import JWTConfig, JWTService, TokenType - # ── PasswordHasher 测试 ────────────────────────────────────────────────────── @@ -226,8 +230,10 @@ class TestPasswordValidator: def test_special_chars_all_types(self): """验证各种特殊字符都能识别""" v = PasswordValidator( - min_length=8, require_uppercase=False, - require_lowercase=False, require_digit=False, + min_length=8, + require_uppercase=False, + require_lowercase=False, + require_digit=False, require_special=True, ) for char in "!@#$%^&*()_+-=[]{}|;:,.<>?~": @@ -289,15 +295,18 @@ class TestJWTConfig: with pytest.raises(ValueError): JWTConfig(secret_key=None) - @pytest.mark.parametrize("insecure", [ - "your-secret-key-change-in-production", - "your-secret-key", - "secret", - "changeme", - "password", - "SECRET", - "Your-Secret-Key", - ]) + @pytest.mark.parametrize( + "insecure", + [ + "your-secret-key-change-in-production", + "your-secret-key", + "secret", + "changeme", + "password", + "SECRET", + "Your-Secret-Key", + ], + ) def test_insecure_defaults_raises(self, insecure): with pytest.raises(ValueError, match="insecure"): JWTConfig(secret_key=insecure)