Files
imeai-aKode/akode-rs/app-server/tests/common/config_tests.rs
andrea.difonzo 7c1c6dfa8d Rinomina: crate akode-*, cartelle akode-rs/ e akode-cli/, binario akode, ~/.akode, AKODE_* (A)
Riapplica la fase 5 di aKode (86e7c72e) sulla base ripulita:
- crate codex-* -> akode-*, codex-rs -> akode-rs, codex-cli -> akode-cli, binario e ausiliari akode;
- ~/.codex -> ~/.akode, CODEX_HOME -> AKODE_HOME, variabili CODEX_* -> AKODE_*, .codex/ -> .akode/ di progetto;
  nessun fallback a ~/.codex o a CODEX_*;
- testi per l'utente "Codex" -> "aKode"; testi verso il modello e istruzioni di sistema invariati;
- snapshot insta rinominati (non ancora rigenerati).
I conflitti con la base ripulita sono stati risolti riapplicando la rinomina ai file senza le
funzioni di imeAI (script di mappa dei token per file).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 12:37:52 +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("chatgpt_base_url = \"http://127.0.0.1:1234\"")
.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\"",
"chatgpt_base_url = \"http://127.0.0.1:1234\"",
"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}");
}
}