mirror of
https://github.com/openai/codex.git
synced 2026-10-23 18:08:45 +00:00
## What changed - Prefetch ChatGPT account eligibility in the background and cache it across TUI widget replacements. - Show an application link when Daybreak is available but not enabled, an Astra-specific explanation for unsupported models, and neutral copy when access is already present or eligibility cannot be determined. - Refresh eligibility after account changes and reconnects without changing the selected model or delaying refusal handling. ## Testing - Cover eligibility responses, account changes, model-specific notices, fallback behavior, and rendered notice snapshots. GitOrigin-RevId: 7ae8613a946cb46b8f0b46bf47e5e15ae258ed86
38 lines
1.1 KiB
Rust
38 lines
1.1 KiB
Rust
use super::*;
|
|
use pretty_assertions::assert_eq;
|
|
use serde_json::json;
|
|
|
|
#[test]
|
|
fn refusal_copy_uses_verified_access() {
|
|
for (programs, expected) in [
|
|
(json!([]), Notice::Apply),
|
|
(
|
|
json!([{"program":"cyber","state":"inactive","grants":[]}]),
|
|
Notice::Apply,
|
|
),
|
|
(
|
|
json!([{"program":"cyber","state":"unavailable","grants":[]}]),
|
|
Notice::Limited,
|
|
),
|
|
(
|
|
json!([{"program":"cyber","state":"active","grants":[{"level":"tac2"}]}]),
|
|
Notice::Limited,
|
|
),
|
|
(
|
|
json!([{"program":"cyber","state":"active","grants":[]}]),
|
|
Notice::Limited,
|
|
),
|
|
(
|
|
json!([{"program":"cyber","state":"inactive","grants":[{"level":"tac2"}]}]),
|
|
Notice::Limited,
|
|
),
|
|
(
|
|
json!([{"program":"cyber","state":"unknown","grants":[]}]),
|
|
Notice::Limited,
|
|
),
|
|
] {
|
|
let access: VerifiedAccess = serde_json::from_value(json!({"programs": programs})).unwrap();
|
|
assert_eq!(access.notice(), expected);
|
|
}
|
|
}
|