test(api): add autospec to MagicMock-based patch usage (#32752)

This commit is contained in:
-LAN-
2026-03-01 04:30:45 +08:00
committed by GitHub
parent c034eb036c
commit 20fcc95db9
86 changed files with 865 additions and 804 deletions

View File

@ -360,7 +360,7 @@ class TestEndToEndCacheFlow:
class TestRedisFailover:
"""Test behavior when Redis is unavailable."""
@patch("services.api_token_service.redis_client")
@patch("services.api_token_service.redis_client", autospec=True)
def test_graceful_degradation_when_redis_fails(self, mock_redis):
"""Test system degrades gracefully when Redis is unavailable."""
from redis import RedisError