mirror of
https://github.com/openai/codex.git
synced 2026-11-07 20:30:33 +00:00
test: normalize project trust fixtures
Use the production project trust key helper in hook trust tests and normalize the migrated project expectation so Windows canonical path handling matches runtime behavior. Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
@@ -8,6 +8,7 @@ use crate::config_loader::NetworkDomainPermissionToml;
|
||||
use crate::config_loader::NetworkDomainPermissionsToml;
|
||||
use crate::config_loader::RequirementSource;
|
||||
use crate::config_loader::Sourced;
|
||||
use crate::config_loader::project_trust_key;
|
||||
use crate::exec::ExecCapturePolicy;
|
||||
use crate::function_tool::FunctionCallError;
|
||||
use crate::shell::default_user_shell;
|
||||
@@ -335,7 +336,7 @@ async fn write_project_trust_config(
|
||||
.iter()
|
||||
.map(|(project, trust_level)| {
|
||||
(
|
||||
project.to_string_lossy().to_string(),
|
||||
project_trust_key(project),
|
||||
ProjectConfig {
|
||||
trust_level: Some(*trust_level),
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@ use crate::config::edit::ConfigEdit;
|
||||
use crate::config::edit::ConfigEditsBuilder;
|
||||
use crate::config::edit::apply_blocking;
|
||||
use crate::config_loader::RequirementSource;
|
||||
use crate::config_loader::project_trust_key;
|
||||
use crate::plugins::PluginsManager;
|
||||
use assert_matches::assert_matches;
|
||||
use codex_config::CONFIG_TOML_FILE;
|
||||
@@ -5110,7 +5111,9 @@ model = "foo""#;
|
||||
|
||||
// Since we created the [projects] table as part of migration, it is kept implicit.
|
||||
// Expect explicit per-project tables, preserving prior entries and appending the new one.
|
||||
let expected = r#"toplevel = "baz"
|
||||
let new_project_key = project_trust_key(new_project);
|
||||
let expected = format!(
|
||||
r#"toplevel = "baz"
|
||||
model = "foo"
|
||||
|
||||
[projects."/Users/mbolin/code/codex4"]
|
||||
@@ -5120,9 +5123,10 @@ foo = "bar"
|
||||
[projects."/Users/mbolin/code/codex3"]
|
||||
trust_level = "trusted"
|
||||
|
||||
[projects."/Users/mbolin/code/codex2"]
|
||||
[projects."{new_project_key}"]
|
||||
trust_level = "trusted"
|
||||
"#;
|
||||
"#
|
||||
);
|
||||
assert_eq!(contents, expected);
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user