Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /SHAdd0WTAka_Zen-Ai-Pentest /tests /unit /test_chaos.py
| from unittest.mock import AsyncMock, MagicMock, patch | |
| import pytest | |
| pytestmark = pytest.mark.asyncio(loop_scope="module") | |
| async def test_db_unreachable(): | |
| with patch("database.connection.create_engine") as mock: | |
| mock.side_effect = ConnectionError("DB unreachable") | |
| with pytest.raises(ConnectionError): | |
| raise ConnectionError("DB unreachable") | |
| async def test_cache_unreachable(): | |
| with patch("core.cache.CacheManager") as mock: | |
| mock.side_effect = ConnectionError("Cache unreachable") | |
| with pytest.raises(ConnectionError): | |
| raise ConnectionError("Cache unreachable") | |
| async def test_tool_timeout(): | |
| with patch("asyncio.wait_for") as mock: | |
| mock.side_effect = TimeoutError("Tool timed out") | |
| with pytest.raises(TimeoutError): | |
| await mock() | |
| async def test_empty_template(): | |
| from core.template_engine import TemplateDefinition, TemplateEngine, TemplateInfo | |
| engine = TemplateEngine() | |
| td = TemplateDefinition(id="test", info=TemplateInfo(name="test", description="")) | |
| result = await engine.run_template(td, "http://test.local") | |
| assert result is not None | |
Xet Storage Details
- Size:
- 1.17 kB
- Xet hash:
- 92b48946cf67adbd886cf2fbb377d455c273863751ebc0704b756895f20e4121
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.