mirror of
https://github.com/openai/codex.git
synced 2026-04-28 02:11:08 +03:00
dry
This commit is contained in:
26
codex-rs/mcp-server/tests/common/config.rs
Normal file
26
codex-rs/mcp-server/tests/common/config.rs
Normal 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
|
||||
"#
|
||||
),
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user