mirror of
https://github.com/openai/codex.git
synced 2026-10-22 17:58:46 +00:00
[codex] cover app-owned HTTP requests [ci changed_files]
This commit is contained in:
@@ -77,6 +77,18 @@ fn stores_state_in_one_file_per_surface() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn derives_an_independent_surface_selection() {
|
||||
let codex_home = TempDir::new().expect("tempdir");
|
||||
let cli = HttpStateContext::new(codex_home.path().to_path_buf(), HttpStateSurface::CodexCli);
|
||||
let desktop = cli.for_surface(HttpStateSurface::CodexDesktop);
|
||||
|
||||
desktop.set_surface(HttpStateSurface::CodexVscode);
|
||||
|
||||
assert_eq!(cli.surface(), HttpStateSurface::CodexCli);
|
||||
assert_eq!(desktop.surface(), HttpStateSurface::CodexVscode);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn compare_and_set_rejects_a_stale_prior_value() {
|
||||
let codex_home = TempDir::new().expect("tempdir");
|
||||
|
||||
@@ -247,6 +247,13 @@ impl HttpStateContext {
|
||||
true
|
||||
}
|
||||
|
||||
pub fn for_surface(&self, surface: HttpStateSurface) -> Self {
|
||||
Self {
|
||||
store: self.store.clone(),
|
||||
surface: Arc::new(RwLock::new(surface)),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_for_surface(&self, surface: HttpStateSurface) -> io::Result<Option<String>> {
|
||||
self.store.get(surface)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user