added sandbox and bash tool
This commit is contained in:
@@ -54,3 +54,29 @@ def sample_history():
|
||||
{"role": "assistance", "content": "Hi there!"},
|
||||
{"role": "user", "content": "What's 2+2?"},
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_sandbox():
|
||||
"""Mock sandbox for unit tests."""
|
||||
sandbox = MagicMock()
|
||||
sandbox.run = AsyncMock(return_value="mock output\n")
|
||||
return sandbox
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def crashed_sandbox():
|
||||
"""Mock sandbox that simulates a crash."""
|
||||
sandbox = MagicMock()
|
||||
sandbox.run = AsyncMock(side_effect=RuntimeError("Container crashed unexpectedly"))
|
||||
return sandbox
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_podman_client():
|
||||
"""Mock Podman client for unit tests."""
|
||||
with patch("sandbox.session.podman.PodmanClient") as mock:
|
||||
mock_container = MagicMock()
|
||||
mock_container.exec_run.return_value = (0, b"mock output\n")
|
||||
mock.return_value.containers.run.return_value = mock_container
|
||||
yield mock, mock_container
|
||||
|
||||
Reference in New Issue
Block a user