This commit is contained in:
Ahmed Ibrahim
2025-08-02 19:13:00 -07:00
parent 2e07f4b033
commit 2a40d07a06

View File

@@ -0,0 +1,26 @@
use std::path::Path;
/// Write a minimal Codex config.toml pointing at the provided mock server URI.
/// Used by tests that don't exercise approval/sandbox variations.
pub fn create_config_toml(codex_home: &Path, server_uri: &str) -> std::io::Result<()> {
let config_toml = codex_home.join("config.toml");
std::fs::write(
config_toml,
format!(
r#"
model = "mock-model"
approval_policy = "never"
sandbox_mode = "danger-full-access"
model_provider = "mock_provider"
[model_providers.mock_provider]
name = "Mock provider for test"
base_url = "{server_uri}/v1"
wire_api = "chat"
request_max_retries = 0
stream_max_retries = 0
"#
),
)
}