mirror of
https://github.com/openai/codex.git
synced 2026-11-16 22:00:36 +00:00
28 lines
828 B
Rust
28 lines
828 B
Rust
#![allow(clippy::unwrap_used, clippy::expect_used)]
|
|
use core_test_support::responses::{ev_completed, mount_sse_once_match, sse, start_mock_server};
|
|
use core_test_support::test_codex_exec::test_codex_exec;
|
|
use wiremock::matchers::header;
|
|
|
|
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
|
|
async fn exec_uses_codex_api_key_env_var() -> anyhow::Result<()> {
|
|
let test = test_codex_exec();
|
|
let server = start_mock_server().await;
|
|
|
|
mount_sse_once_match(
|
|
&server,
|
|
header("Authorization", "Bearer dummy"),
|
|
sse(vec![ev_completed("request_0")]),
|
|
)
|
|
.await;
|
|
|
|
test.cmd_with_server(&server)
|
|
.arg("--skip-git-repo-check")
|
|
.arg("-C")
|
|
.arg(env!("CARGO_MANIFEST_DIR"))
|
|
.arg("echo testing codex api key")
|
|
.assert()
|
|
.success();
|
|
|
|
Ok(())
|
|
}
|