mirror of
https://github.com/openai/codex.git
synced 2026-04-28 00:25:56 +00:00
Add codex debug models to show model catalog (#18625)
This commit is contained in:
committed by
GitHub
parent
87fc21ff60
commit
ab65fbbdd6
40
codex-rs/cli/tests/debug_models.rs
Normal file
40
codex-rs/cli/tests/debug_models.rs
Normal file
@@ -0,0 +1,40 @@
|
||||
use std::path::Path;
|
||||
|
||||
use anyhow::Result;
|
||||
use tempfile::TempDir;
|
||||
|
||||
fn codex_command(codex_home: &Path) -> Result<assert_cmd::Command> {
|
||||
let mut cmd = assert_cmd::Command::new(codex_utils_cargo_bin::cargo_bin("codex")?);
|
||||
cmd.env("CODEX_HOME", codex_home);
|
||||
Ok(cmd)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn debug_models_bundled_prints_json() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let mut cmd = codex_command(codex_home.path())?;
|
||||
let output = cmd.args(["debug", "models", "--bundled"]).output()?;
|
||||
|
||||
assert!(output.status.success());
|
||||
let stdout = String::from_utf8(output.stdout)?;
|
||||
let value: serde_json::Value = serde_json::from_str(&stdout)?;
|
||||
assert!(value["models"].is_array());
|
||||
assert!(!value["models"].as_array().unwrap_or(&Vec::new()).is_empty());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn debug_models_default_prints_json_without_auth() -> Result<()> {
|
||||
let codex_home = TempDir::new()?;
|
||||
let mut cmd = codex_command(codex_home.path())?;
|
||||
let output = cmd.args(["debug", "models"]).output()?;
|
||||
|
||||
assert!(output.status.success());
|
||||
let stdout = String::from_utf8(output.stdout)?;
|
||||
let value: serde_json::Value = serde_json::from_str(&stdout)?;
|
||||
assert!(value["models"].is_array());
|
||||
assert!(!value["models"].as_array().unwrap_or(&Vec::new()).is_empty());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user