Skip to content

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

test(composio): cover empty connectable toolkit provider

Steven Enamakel0c48c7f08117
diff --git a/crates/openhuman-core/src/integrations/composio/builder_tools/owner_tools_tests.rs b/crates/openhuman-core/src/integrations/composio/builder_tools/owner_tools_tests.rs
index 684cdb54b6..c54c7fbc41 100644
--- a/crates/openhuman-core/src/integrations/composio/builder_tools/owner_tools_tests.rs
+++ b/crates/openhuman-core/src/integrations/composio/builder_tools/owner_tools_tests.rs
@@ -8,6 +8,32 @@ use tinytools::{PermissionLevel, Tool};
use crate::config::Config;
use crate::integrations::composio::catalog::{seed_live_catalog_cache, seed_probe_cache, ProbedOutputSample, ToolContract};
+struct EmptyConnectableProvider;
+
+#[async_trait::async_trait]
+impl ConnectableToolkitProvider for EmptyConnectableProvider {
+ async fn connected(
+ &self,
+ _dispatch: &crate::core::runtime::DispatchCtx,
+ _config: &Config,
+ ) -> Vec<String> {
+ Vec::new()
+ }
+}
+
+#[tokio::test]
+async fn connectable_toolkits_uses_the_injected_host_snapshot_and_fails_closed_empty() {
+ let tmp = TempDir::new().unwrap();
+ let tool = ListConnectableToolkitsTool::new(
+ test_config(&tmp),
+ Arc::new(EmptyConnectableProvider),
+ );
+ let result = tool.execute(json!({})).await.unwrap();
+ assert!(!result.is_error, "{}", result.output());
+ let value: Value = serde_json::from_str(&result.output()).unwrap();
+ assert!(value["toolkits"].as_array().unwrap().iter().all(|item| item["connected"] == false));
+}
+
fn test_config(tmp: &TempDir) -> Arc<Config> {
let config = Config { workspace_dir: tmp.path().join("workspace"), action_dir: tmp.path().join("workspace"), config_path: tmp.path().join("config.toml"), ..Config::default() };
std::fs::create_dir_all(&config.workspace_dir).unwrap();