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
fix(tests): initialize encrypted hosted credential fixtures
Steven Enamakelc2d8784fcd8b
diff --git a/crates/openhuman-tinyhumans/src/hosted/client_tests.rs b/crates/openhuman-tinyhumans/src/hosted/client_tests.rsindex 07b6bb421f..f58dfe6b7f 100644--- a/crates/openhuman-tinyhumans/src/hosted/client_tests.rs+++ b/crates/openhuman-tinyhumans/src/hosted/client_tests.rs@@ -1,8 +1,8 @@use super::*;+use crate::hosted::test_support::store_session;use openhuman_embed::__host::core::observability::{expected_error_kind, is_api_key_rejected_message, is_session_expired_message,};-use openhuman_embed::__host::security::credentials::{AuthService, APP_SESSION_PROVIDER};use serde_json::json;use tempfile::TempDir;use wiremock::matchers::{header, method, path};@@ -18,18 +18,6 @@ fn test_config(tmp: &TempDir, api_url: &str) -> Config {}}-fn store_session(config: &Config, token: &str) {- AuthService::from_config(config)- .store_provider_token(- APP_SESSION_PROVIDER,- "default",- token,- std::collections::HashMap::new(),- true,- )- .expect("store session token");-}-#[test]fn backend_origin_strips_path_query_and_fragment() {assert_eq!(diff --git a/crates/openhuman-tinyhumans/src/hosted/referral/ops_tests.rs b/crates/openhuman-tinyhumans/src/hosted/referral/ops_tests.rsindex 676a566481..c46d68e592 100644--- a/crates/openhuman-tinyhumans/src/hosted/referral/ops_tests.rs+++ b/crates/openhuman-tinyhumans/src/hosted/referral/ops_tests.rs@@ -1,11 +1,9 @@use super::*;+use crate::hosted::test_support::store_session as store_session_token;use axum::{routing::{get, post},Json, Router,};-use openhuman_embed::__host::security::credentials::{- AuthService, APP_SESSION_PROVIDER, DEFAULT_AUTH_PROFILE_NAME,-};use serde_json::json;use tempfile::TempDir;@@ -18,18 +16,6 @@ fn test_config(tmp: &TempDir) -> Config {}}-fn store_session_token(config: &Config, token: &str) {- AuthService::from_config(config)- .store_provider_token(- APP_SESSION_PROVIDER,- DEFAULT_AUTH_PROFILE_NAME,- token,- std::collections::HashMap::new(),- true,- )- .expect("store token");-}-async fn spawn_mock(app: Router) -> String {let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();let addr = listener.local_addr().unwrap();diff --git a/crates/openhuman-tinyhumans/src/hosted/test_support.rs b/crates/openhuman-tinyhumans/src/hosted/test_support.rsindex 9f2d28ef96..899bc044ad 100644--- a/crates/openhuman-tinyhumans/src/hosted/test_support.rs+++ b/crates/openhuman-tinyhumans/src/hosted/test_support.rs@@ -18,6 +18,32 @@ pub fn config(tmp: &TempDir, api_url: &str) -> Config {/// Store `token` as the app-session credential for `config`.pub fn store_session(config: &Config, token: &str) {+ // The core is a dependency here, so its cfg(test) plaintext keyring is+ // unavailable. Boot the encrypted store with an isolated fixture key just+ // as a headless host does, before the first credential operation.+ static INIT: std::sync::Once = std::sync::Once::new();+ INIT.call_once(|| {+ let workspace = TempDir::new().expect("fixture keyring workspace");+ let variables = [+ "OPENHUMAN_KEYRING_MASTER_KEY",+ "OPENHUMAN_KEYRING_MASTER_KEY_FILE",+ "OPENHUMAN_KEYRING_BACKEND",+ "OPENHUMAN_WORKSPACE",+ ];+ let previous = variables.map(|name| (name, std::env::var_os(name)));+ std::env::remove_var("OPENHUMAN_KEYRING_MASTER_KEY_FILE");+ std::env::set_var("OPENHUMAN_KEYRING_MASTER_KEY", "11".repeat(32));+ std::env::set_var("OPENHUMAN_KEYRING_BACKEND", "encrypted_file");+ std::env::set_var("OPENHUMAN_WORKSPACE", workspace.path());+ let initialized = openhuman_embed::process::init_master_key();+ for (name, value) in previous {+ match value {+ Some(value) => std::env::set_var(name, value),+ None => std::env::remove_var(name),+ }+ }+ initialized.expect("initialize fixture master key");+ });AuthService::from_config(config).store_provider_token(APP_SESSION_PROVIDER,