mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
e752f7b4ae
The workspace denies `clippy::expect_used` in production. Although `clippy.toml` allows `expect` in tests, Bazel Clippy compiles integration-test helper code in a way that does not receive that exemption, which encouraged verbose `unwrap_or_else(... panic!(...))` and equivalent `match`/`let else` forms. This allows `clippy::expect_used` once at each integration-test crate root (including aggregated suites and test-support libraries), then replaces manual panic-based Result and Option unwraps with `expect`/`expect_err`. Standalone `tests/*.rs` files remain their own crate roots. Intentional assertion and unexpected-variant panics remain unchanged, and the production `expect_used = "deny"` lint remains in place. The cleanup is mechanical and net-negative in line count.
32 lines
948 B
Rust
32 lines
948 B
Rust
#![allow(clippy::unwrap_used)]
|
|
use core_test_support::responses::ev_completed;
|
|
use core_test_support::responses::mount_sse_once_match;
|
|
use core_test_support::responses::sse;
|
|
use core_test_support::responses::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;
|
|
let repo_root = codex_utils_cargo_bin::repo_root()?;
|
|
|
|
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(&repo_root)
|
|
.arg("echo testing codex api key")
|
|
.assert()
|
|
.success();
|
|
|
|
Ok(())
|
|
}
|