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): drop redundant openrouter sort assertion
Steven Enamakel993d1e4deb91
diff --git a/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rs b/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rsnew file mode 100644index 0000000000..a224bfafd6--- /dev/null+++ b/crates/openhuman-core/src/inference/provider/factory/cloud_spec_tests.rs@@ -0,0 +1,93 @@+use super::*;++fn entry(slug: &str, endpoint: &str, auth_style: AuthStyle) -> CloudProviderCreds {+ CloudProviderCreds {+ id: format!("p_{slug}"),+ slug: slug.to_string(),+ label: slug.to_string(),+ endpoint: endpoint.to_string(),+ auth_style,+ ..Default::default()+ }+}++fn build<'a>(entry: &CloudProviderCreds, model: &str, key: &'a str) -> CloudBuild<'a> {+ CloudBuild {+ spec: cloud_provider_spec(entry, model),+ auth_style: registry_auth_style(entry.auth_style).expect("not managed"),+ key,+ temperature_override: None,+ temperature_unsupported_models: &[],+ native_tool_calling: true,+ extra_headers: &[],+ extra_query_params: &[],+ user_agent: None,+ codex: None,+ http: None,+ }+}++#[test]+fn spec_keeps_the_slug_as_provider_name_and_picks_the_kind_from_auth() {+ let openai = cloud_provider_spec(+ &entry("my-proxy", "https://proxy.example/v1", AuthStyle::Bearer),+ "m",+ );+ assert_eq!(openai.kind, ProviderKind::Compatible);+ assert_eq!(openai.provider, "my-proxy");+ assert_eq!(openai.base_url, "https://proxy.example/v1");+ assert_eq!(openai.model, "m");+ assert!(!openai.requires_api_key);+ let claude = cloud_provider_spec(+ &entry("anthropic", "https://api.anthropic.com/v1", AuthStyle::Anthropic),+ "claude",+ );+ assert_eq!(claude.kind, ProviderKind::Anthropic);+}++#[test]+fn managed_jwt_style_never_maps_onto_the_registry() {+ assert!(registry_auth_style(AuthStyle::OpenhumanJwt).is_none());+ assert!(registry_auth_style(AuthStyle::Bearer).is_some());+}++#[test]+fn registry_builds_a_model_for_every_unmanaged_builtin_preset() {+ for preset in crate::config::schema::cloud_providers::BUILTIN_CLOUD_PROVIDERS.iter() {+ if preset.auth_style == AuthStyle::OpenhumanJwt {+ continue;+ }+ let creds = entry(preset.slug, preset.endpoint, preset.auth_style);+ build_cloud_model(build(&creds, "some-model", "sk-test"))+ .unwrap_or_else(|error| panic!("{} failed to build: {error}", preset.slug));+ }+}++#[test]+fn discovery_request_carries_bearer_auth_and_pins_openrouter_sorting() {+ let creds = entry("openrouter", "https://openrouter.ai/api/v1", AuthStyle::Bearer);+ let request = cloud_discovery_request(&build(&creds, "m", "sk-or"))+ .expect("openrouter has a listing");+ assert_eq!(request.endpoint, "https://openrouter.ai/api/v1");+ assert!(request+ .headers+ .iter()+ .any(|(name, value)| name == "Authorization" && value == "Bearer sk-or"));+}++#[test]+fn discovery_request_uses_x_api_key_for_anthropic_and_skips_codex_oauth() {+ let claude = entry("anthropic", "https://api.anthropic.com/v1", AuthStyle::Anthropic);+ let request = cloud_discovery_request(&build(&claude, "claude", "sk-ant")).expect("listing");+ assert!(request.headers.iter().any(|(name, _)| name == "x-api-key"));++ let openai = entry("openai", "https://api.openai.com/v1", AuthStyle::Bearer);+ let oauth = OpenAiCodexRouting {+ endpoint: "https://chatgpt.com/backend-api/codex".to_string(),+ using_oauth: true,+ account_id: None,+ };+ let mut with_oauth = build(&openai, "gpt", "tok");+ with_oauth.codex = Some(&oauth);+ assert!(cloud_discovery_request(&with_oauth).is_none());+}diff --git a/crates/openhuman-core/src/inference/provider/factory_crate_native_diagnostics_tests.rs b/crates/openhuman-core/src/inference/provider/factory_crate_native_diagnostics_tests.rsindex 9c0f871bc8..867184b780 100644--- a/crates/openhuman-core/src/inference/provider/factory_crate_native_diagnostics_tests.rs+++ b/crates/openhuman-core/src/inference/provider/factory_crate_native_diagnostics_tests.rs@@ -1,8 +1,6 @@use super::*;-use crate::inference::provider::factory::cloud_slug::{- openrouter_default_provider_options, OPENROUTER_PROVIDER_SORT,-};+use crate::inference::provider::factory::cloud_slug::openrouter_default_provider_options;#[test]fn crate_native_chat_model_factory_preserves_invalid_route_diagnostics() {@@ -173,7 +171,6 @@ fn direct_openrouter_endpoints_get_price_sorted_routing_and_nothing_else() {// reason in tinyhumansai/backend#1370).let options = openrouter_default_provider_options("https://openrouter.ai/api/v1").expect("openrouter endpoint carries routing options");- assert_eq!(OPENROUTER_PROVIDER_SORT, "price");assert_eq!(options,serde_json::json!({ "provider": { "sort": "price" } }),