Build a TestClient with the given trigger setting.
(
mock_session_service,
mock_artifact_service,
mock_memory_service,
mock_agent_loader,
trigger_sources: Optional[list[str]] = None,
)
| 194 | |
| 195 | |
| 196 | def _make_test_client( |
| 197 | mock_session_service, |
| 198 | mock_artifact_service, |
| 199 | mock_memory_service, |
| 200 | mock_agent_loader, |
| 201 | trigger_sources: Optional[list[str]] = None, |
| 202 | ) -> TestClient: |
| 203 | """Build a TestClient with the given trigger setting.""" |
| 204 | with ( |
| 205 | patch.object(signal, "signal", autospec=True, return_value=None), |
| 206 | patch.object( |
| 207 | fast_api_module, |
| 208 | "create_session_service_from_options", |
| 209 | autospec=True, |
| 210 | return_value=mock_session_service, |
| 211 | ), |
| 212 | patch.object( |
| 213 | fast_api_module, |
| 214 | "create_artifact_service_from_options", |
| 215 | autospec=True, |
| 216 | return_value=mock_artifact_service, |
| 217 | ), |
| 218 | patch.object( |
| 219 | fast_api_module, |
| 220 | "create_memory_service_from_options", |
| 221 | autospec=True, |
| 222 | return_value=mock_memory_service, |
| 223 | ), |
| 224 | patch.object( |
| 225 | fast_api_module, |
| 226 | "AgentLoader", |
| 227 | autospec=True, |
| 228 | return_value=mock_agent_loader, |
| 229 | ), |
| 230 | patch.object( |
| 231 | fast_api_module, |
| 232 | "LocalEvalSetsManager", |
| 233 | autospec=True, |
| 234 | return_value=AsyncMock(), |
| 235 | ), |
| 236 | patch.object( |
| 237 | fast_api_module, |
| 238 | "LocalEvalSetResultsManager", |
| 239 | autospec=True, |
| 240 | return_value=AsyncMock(), |
| 241 | ), |
| 242 | ): |
| 243 | app = get_fast_api_app( |
| 244 | agents_dir=".", |
| 245 | web=False, |
| 246 | session_service_uri="", |
| 247 | artifact_service_uri="", |
| 248 | memory_service_uri="", |
| 249 | allow_origins=["*"], |
| 250 | trigger_sources=trigger_sources, |
| 251 | ) |
| 252 | return TestClient(app) |
| 253 |
no test coverage detected