chore: rename CodexAuth::new() to create_dummy_codex_auth_for_testing() because it is not for general consumption

This commit is contained in:
Michael Bolin
2025-08-07 14:47:05 -07:00
parent 7d67159587
commit 1f18d6bcbf
2 changed files with 15 additions and 28 deletions
+10 -18
View File
@@ -1,6 +1,4 @@
#![allow(clippy::expect_used)]
#![allow(clippy::unwrap_used)]
use std::path::PathBuf;
#![allow(clippy::expect_used, clippy::unwrap_used)]
use chrono::Utc;
use codex_core::Codex;
@@ -14,7 +12,6 @@ use codex_core::protocol::Op;
use codex_core::protocol::SessionConfiguredEvent;
use codex_core::spawn::CODEX_SANDBOX_NETWORK_DISABLED_ENV_VAR;
use codex_login::AuthDotJson;
use codex_login::AuthMode;
use codex_login::CodexAuth;
use codex_login::TokenData;
use core_test_support::load_default_config_for_test;
@@ -556,19 +553,14 @@ async fn env_var_overrides_loaded_auth() {
}
fn create_dummy_codex_auth() -> CodexAuth {
CodexAuth::new(
None,
AuthMode::ChatGPT,
PathBuf::new(),
Some(AuthDotJson {
openai_api_key: None,
tokens: Some(TokenData {
id_token: Default::default(),
access_token: "Access Token".to_string(),
refresh_token: "test".to_string(),
account_id: Some("account_id".to_string()),
}),
last_refresh: Some(Utc::now()),
CodexAuth::create_dummy_chatgpt_auth_for_testing(AuthDotJson {
openai_api_key: None,
tokens: Some(TokenData {
id_token: Default::default(),
access_token: "Access Token".to_string(),
refresh_token: "test".to_string(),
account_id: Some("account_id".to_string()),
}),
)
last_refresh: Some(Utc::now()),
})
}
+5 -10
View File
@@ -51,17 +51,12 @@ impl PartialEq for CodexAuth {
}
impl CodexAuth {
pub fn new(
api_key: Option<String>,
mode: AuthMode,
auth_file: PathBuf,
auth_dot_json: Option<AuthDotJson>,
) -> Self {
let auth_dot_json = Arc::new(Mutex::new(auth_dot_json));
pub fn create_dummy_chatgpt_auth_for_testing(auth_dot_json: AuthDotJson) -> Self {
let auth_dot_json = Arc::new(Mutex::new(Some(auth_dot_json)));
Self {
api_key,
mode,
auth_file,
api_key: None,
mode: AuthMode::ChatGPT,
auth_file: PathBuf::new(),
auth_dot_json,
}
}