The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
test(hosting): cover disabled hosting component behaviour
Steven Enamakel24b2c6b3d5e5
diff --git a/crates/openhuman-core/src/config/schema/hosting_tests.rs b/crates/openhuman-core/src/config/schema/hosting_tests.rsindex 8109901634..64fdd40c19 100644--- a/crates/openhuman-core/src/config/schema/hosting_tests.rs+++ b/crates/openhuman-core/src/config/schema/hosting_tests.rs@@ -36,9 +36,8 @@ fn a_configured_key_and_team_are_reported() {#[test]fn the_section_round_trips_through_toml() {let config: HostingConfig =- toml::from_str("enabled = true\napi_key = \"token\"\n").expect("parses");+ toml::from_str("api_key = \"token\"\n").expect("parses");- assert!(config.enabled);assert_eq!(config.provider, "vercel");assert_eq!(config.api_key, "token");}@@ -46,7 +45,7 @@ fn the_section_round_trips_through_toml() {#[test]fn the_team_scope_round_trips_through_toml() {let config: HostingConfig =- toml::from_str("enabled = true\nteam = \"team_abc\"\n").expect("parses");+ toml::from_str("team = \"team_abc\"\n").expect("parses");assert_eq!(config.team(), Some("team_abc"));}diff --git a/crates/openhuman-core/src/hosting/hosting_tests.rs b/crates/openhuman-core/src/hosting/hosting_tests.rsindex aa20f10d6b..ae0e16af96 100644--- a/crates/openhuman-core/src/hosting/hosting_tests.rs+++ b/crates/openhuman-core/src/hosting/hosting_tests.rs@@ -584,3 +584,12 @@ fn only_the_tools_that_change_the_world_carry_an_external_effect() {);}}++#[test]+fn a_disabled_hosting_component_registers_no_tools_despite_a_credential() {+ let workspace = tempfile::tempdir().expect("workspace");+ let config = config_with(workspace.path(), false, "token");+ assert!(Account::from_config(&config).unwrap().is_none());+ let config = config_with(workspace.path(), true, "token");+ assert!(Account::from_config(&config).unwrap().is_some());+}diff --git a/crates/openhuman-core/src/modules/ops_components_tests.rs b/crates/openhuman-core/src/modules/ops_components_tests.rsindex c0eb26aac3..4ecd21bd95 100644--- a/crates/openhuman-core/src/modules/ops_components_tests.rs+++ b/crates/openhuman-core/src/modules/ops_components_tests.rs@@ -56,3 +56,16 @@ async fn a_disabled_wallet_never_loads_the_tinywallet_module() {assert_eq!(err.into_message(), "COMPONENT_DISABLED:wallet");assert_eq!(state_of("tinywallet"), ModuleState::Available);}++#[tokio::test]+async fn a_disabled_hosting_component_never_loads_the_tinyhosts_module() {+ let config = config_without("hosting");+ let err = ensure_loaded_within(&config, "tinyhosts", None)+ .await+ .unwrap_err();+ assert_eq!(err, LoadError::Disabled("hosting"));+ assert_eq!(err.into_message(), "COMPONENT_DISABLED:hosting");+ let statuses = list(&config);+ let status = statuses.iter().find(|s| s.id == "tinyhosts").unwrap();+ assert_eq!(status.state, ModuleState::Disabled);+}