tests-upgrade
All checks were successful
Deploy on push / deploy (push) Successful in 57m1s

This commit is contained in:
2025-09-25 09:40:12 +03:00
parent 1992434a13
commit ac0111cdb9
17 changed files with 766 additions and 363 deletions

View File

@@ -64,7 +64,7 @@ class TestRedisConnectionManagement:
"""Тест неудачного подключения"""
service = RedisService()
with patch("storage.redis.aioredis.from_url") as mock_from_url:
with patch("storage.redis.aioredis.ConnectionPool.from_url") as mock_from_url:
mock_from_url.side_effect = Exception("Connection failed")
await service.connect()
@@ -852,18 +852,17 @@ class TestAdditionalRedisCoverage:
assert service._client is not None
async def test_disconnect_exception_handling(self):
"""Test disconnect with exception"""
"""Test disconnect with exception - should log error but not raise"""
service = RedisService()
mock_client = AsyncMock()
service._client = mock_client
mock_client.close.side_effect = Exception("Disconnect error")
# The disconnect method doesn't handle exceptions, so it should raise
with pytest.raises(Exception, match="Disconnect error"):
await service.close()
# The disconnect method handles exceptions gracefully - should not raise
await service.close()
# Since exception is not handled, client remains unchanged
assert service._client is mock_client
# Client should be set to None even if close() failed
assert service._client is None
async def test_get_and_deserialize_exception(self):
"""Test get_and_deserialize with exception"""