Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(integrations): add test support backend

Steven Enamakel2aa5f081a235
diff --git a/crates/openhuman-core/src/integrations/test_support_backend.rs b/crates/openhuman-core/src/integrations/test_support_backend.rs
index 3ee3d623f7..237100556f 100644
--- a/crates/openhuman-core/src/integrations/test_support_backend.rs
+++ b/crates/openhuman-core/src/integrations/test_support_backend.rs
@@ -4,108 +4,6 @@ pub async fn spawn_fake_integration_backend() -> FakeIntegrationBackend {
};
let app = Router::new()
- .route(
- "/agent-integrations/apify/run",
- post({
- let state = state.clone();
- move |Json(body): Json<Value>| async move {
- record(
- &state,
- "POST",
- "/agent-integrations/apify/run".to_string(),
- body.clone(),
- );
- let actor_id = body
- .get("actorId")
- .and_then(Value::as_str)
- .unwrap_or("unknown-actor");
- let run_id = format!("run-{}", actor_id.replace('/', "-"));
- let input = body.get("input").cloned().unwrap_or(Value::Null);
- Json(json!({
- "success": true,
- "data": {
- "runId": run_id,
- "actorId": actor_id,
- "status": if body.get("sync").and_then(Value::as_bool).unwrap_or(true) { "SUCCEEDED" } else { "RUNNING" },
- "datasetId": format!("dataset-{}", actor_id.replace('/', "-")),
- "items": [
- {
- "actorId": actor_id,
- "inputEcho": input
- }
- ],
- "costUsd": 0.31
- }
- }))
- }
- }),
- )
- .route(
- "/agent-integrations/apify/runs/{run_id}",
- get({
- let state = state.clone();
- move |Path(run_id): Path<String>| async move {
- record(
- &state,
- "GET",
- format!("/agent-integrations/apify/runs/{run_id}"),
- Value::Null,
- );
- Json(json!({
- "success": true,
- "data": {
- "runId": run_id,
- "actorId": "apify/linkedin-profile-scraper",
- "status": "SUCCEEDED",
- "datasetId": format!("dataset-{run_id}"),
- "costUsd": 0.02
- }
- }))
- }
- }),
- )
- .route(
- "/agent-integrations/apify/runs/{run_id}/results",
- get({
- let state = state.clone();
- move |Path(run_id): Path<String>,
- Query(params): Query<HashMap<String, String>>| async move {
- let limit = params
- .get("limit")
- .and_then(|v| v.parse::<usize>().ok())
- .unwrap_or(3);
- let offset = params
- .get("offset")
- .and_then(|v| v.parse::<usize>().ok())
- .unwrap_or(0);
- record(
- &state,
- "GET",
- format!(
- "/agent-integrations/apify/runs/{run_id}/results?limit={limit}&offset={offset}"
- ),
- Value::Null,
- );
- let items: Vec<Value> = (0..limit)
- .map(|idx| {
- let n = offset + idx;
- json!({
- "runId": run_id,
- "index": n,
- "url": format!("https://example.com/{run_id}/{n}")
- })
- })
- .collect();
- Json(json!({
- "success": true,
- "data": {
- "items": items,
- "total": offset + limit + 5
- }
- }))
- }
- }),
- )
.route(
"/agent-integrations/google-places/search",
post({
@@ -582,31 +480,6 @@ pub async fn spawn_fake_integration_backend() -> FakeIntegrationBackend {
}
}),
)
- .route(
- "/agent-integrations/twilio/call",
- post({
- let state = state.clone();
- move |Json(body): Json<Value>| async move {
- record(
- &state,
- "POST",
- "/agent-integrations/twilio/call".to_string(),
- body.clone(),
- );
- let to = body.get("to").and_then(Value::as_str).unwrap_or("+10000000000");
- let suffix: String = to.chars().filter(|c| c.is_ascii_digit()).rev().take(4).collect();
- let suffix: String = suffix.chars().rev().collect();
- Json(json!({
- "success": true,
- "data": {
- "callSid": format!("CA{suffix}"),
- "status": "queued",
- "costUsd": 0.03
- }
- }))
- }
- }),
- )
.route(
"/agent-integrations/tinyfish/search",
post({