diff --git a/codex-rs/mcp-server/tests/common/config.rs b/codex-rs/mcp-server/tests/common/config.rs new file mode 100644 index 0000000000..b147de00ca --- /dev/null +++ b/codex-rs/mcp-server/tests/common/config.rs @@ -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 +"# + ), + ) +}