Files
andrea.difonzo 24a3cfe2f4 aKode: eliminato chatgpt_base_url ormai inutilizzato
- La chiave è ancora accettata nei file di configurazione ma ignorata.
- Schemi JSON e TypeScript dell'app-server rigenerati; i bundle ora si
  chiamano akode_app_server_protocol*.schemas.json, come produce il
  generatore.
- app-server: niente più avviso unused_mut nella build release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-11 16:40:27 +01:00

70 lines
2.6 KiB
Rust

use super::*;
use tempfile::TempDir;
#[test]
fn mock_responses_config_composes_model_provider_features_and_extra_tables() {
let home = TempDir::new().expect("temporary AKODE_HOME");
MockResponsesConfig::new("http://127.0.0.1:1234")
.with_model("custom-model")
.with_model_provider("openai-custom")
.with_provider_name("OpenAI")
.with_provider_base_url("http://127.0.0.1:1234/api/codex")
.with_approval_policy("on-request")
.with_sandbox_mode("workspace-write")
.enable_feature(Feature::FastMode)
.disable_feature(Feature::ShellSnapshot)
.with_root_config("check_for_update_on_startup = false")
.with_provider_config("requires_openai_auth = true")
.with_extra_config("[extra]\nenabled = true")
.write(home.path())
.expect("write composable mock Responses config");
let config =
std::fs::read_to_string(home.path().join("config.toml")).expect("read config.toml");
for expected in [
"model = \"custom-model\"",
"approval_policy = \"on-request\"",
"sandbox_mode = \"workspace-write\"",
"check_for_update_on_startup = false",
"model_provider = \"openai-custom\"",
"shell_snapshot = false",
"fast_mode = true",
"[model_providers.openai-custom]\nname = \"OpenAI\"",
"base_url = \"http://127.0.0.1:1234/api/codex\"",
"requires_openai_auth = true",
"[extra]\nenabled = true",
] {
assert!(config.contains(expected), "config is missing {expected}");
}
}
#[test]
fn legacy_mock_responses_writer_preserves_provider_auth_and_feature_overrides() {
let home = TempDir::new().expect("temporary AKODE_HOME");
write_mock_responses_config_toml(
home.path(),
"http://127.0.0.1:1234",
&BTreeMap::from([(Feature::FastMode, true), (Feature::ShellSnapshot, false)]),
/*auto_compact_limit*/ 321,
Some(true),
"openai",
"compact this",
)
.expect("write legacy-compatible mock Responses config");
let config =
std::fs::read_to_string(home.path().join("config.toml")).expect("read config.toml");
for expected in [
"compact_prompt = \"compact this\"",
"model_auto_compact_token_limit = 321",
"openai_base_url = \"http://127.0.0.1:1234/v1\"",
"shell_snapshot = false",
"fast_mode = true",
"[model_providers.openai]\nname = \"OpenAI\"",
"supports_websockets = false",
"requires_openai_auth = true",
] {
assert!(config.contains(expected), "config is missing {expected}");
}
}