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(inference): wrap credential inspection test in library context
Steven Enamakel2b8f72e2451e
diff --git a/crates/openhuman-core/src/inference/provider/factory_tests.rs b/crates/openhuman-core/src/inference/provider/factory_tests.rsindex cb0e4ff499..e87436249b 100644--- a/crates/openhuman-core/src/inference/provider/factory_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_tests.rs@@ -179,59 +179,61 @@ fn config_with_providers_in_tempdir(tmp: &TempDir, providers: Vec<CloudProviderC#[test]fn inspection_requires_credentials_for_explicit_authenticated_cloud_routes() {- let tmp = TempDir::new().expect("temporary provider workspace");- let mut provider = openai_entry("p_missing_key", "factory-missing-key-test");- let mut config = config_with_providers_in_tempdir(&tmp, vec![provider.clone()]);- config.chat_provider = Some("factory-missing-key-test:gpt-4o".to_string());-- let inspection = super::inspection::create_chat_model_with_model_id_in_for_inspection(- &crate::core::runtime::DispatchCtx::ambient(),- "chat",- &config,- 0.0,- );- assert!(- inspection.is_err(),- "inspection must reject explicit Bearer routes without credentials"- );-- let runtime = super::chat_model::create_chat_model_with_model_id_in(- &crate::core::runtime::DispatchCtx::ambient(),- "chat",- &config,- 0.0,- );- assert!(- runtime.is_ok(),- "runtime construction preserves explicit routes before a key is saved: {:?}",- runtime.err()- );+ with_library_test_context(|| {+ let tmp = TempDir::new().expect("temporary provider workspace");+ let mut provider = openai_entry("p_missing_key", "factory-missing-key-test");+ let mut config = config_with_providers_in_tempdir(&tmp, vec![provider.clone()]);+ config.chat_provider = Some("factory-missing-key-test:gpt-4o".to_string());- provider.auth_style = AuthStyle::Anthropic;- config.cloud_providers = vec![provider.clone()];- assert!(- super::inspection::create_chat_model_with_model_id_in_for_inspection(+ let inspection = super::inspection::create_chat_model_with_model_id_in_for_inspection(&crate::core::runtime::DispatchCtx::ambient(),"chat",&config,0.0,- )- .is_err(),- "inspection must reject explicit Anthropic routes without credentials"- );+ );+ assert!(+ inspection.is_err(),+ "inspection must reject explicit Bearer routes without credentials"+ );- provider.auth_style = AuthStyle::None;- config.cloud_providers = vec![provider];- assert!(- super::inspection::create_chat_model_with_model_id_in_for_inspection(+ let runtime = super::chat_model::create_chat_model_with_model_id_in(&crate::core::runtime::DispatchCtx::ambient(),"chat",&config,0.0,- )- .is_ok(),- "unauthenticated proxy routes do not require a stored credential"- );+ );+ assert!(+ runtime.is_ok(),+ "runtime construction preserves explicit routes before a key is saved: {:?}",+ runtime.err()+ );++ provider.auth_style = AuthStyle::Anthropic;+ config.cloud_providers = vec![provider.clone()];+ assert!(+ super::inspection::create_chat_model_with_model_id_in_for_inspection(+ &crate::core::runtime::DispatchCtx::ambient(),+ "chat",+ &config,+ 0.0,+ )+ .is_err(),+ "inspection must reject explicit Anthropic routes without credentials"+ );++ provider.auth_style = AuthStyle::None;+ config.cloud_providers = vec![provider];+ assert!(+ super::inspection::create_chat_model_with_model_id_in_for_inspection(+ &crate::core::runtime::DispatchCtx::ambient(),+ "chat",+ &config,+ 0.0,+ )+ .is_ok(),+ "unauthenticated proxy routes do not require a stored credential"+ );+ });}fn oh_entry(id: &str) -> CloudProviderCreds {