mirror of
https://github.com/openai/codex.git
synced 2026-05-02 10:26:45 +00:00
tests: submit websocket turns with permission profiles
This commit is contained in:
@@ -630,15 +630,6 @@ impl TestCodex {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn submit_turn_with_policy(
|
||||
&self,
|
||||
prompt: &str,
|
||||
sandbox_policy: SandboxPolicy,
|
||||
) -> Result<()> {
|
||||
self.submit_turn_with_policies(prompt, AskForApproval::Never, sandbox_policy)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn submit_turn_with_service_tier(
|
||||
&self,
|
||||
prompt: &str,
|
||||
@@ -654,26 +645,6 @@ impl TestCodex {
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn submit_turn_with_policies(
|
||||
&self,
|
||||
prompt: &str,
|
||||
approval_policy: AskForApproval,
|
||||
sandbox_policy: SandboxPolicy,
|
||||
) -> Result<()> {
|
||||
let permission_profile = PermissionProfile::from_legacy_sandbox_policy_for_cwd(
|
||||
&sandbox_policy,
|
||||
self.config.cwd.as_path(),
|
||||
);
|
||||
self.submit_turn_with_context(
|
||||
prompt,
|
||||
approval_policy,
|
||||
permission_profile,
|
||||
/*service_tier*/ None,
|
||||
/*environments*/ None,
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn submit_turn_with_approval_and_permission_profile(
|
||||
&self,
|
||||
prompt: &str,
|
||||
@@ -896,16 +867,6 @@ impl TestCodexHarness {
|
||||
Box::pin(self.test.submit_turn(prompt)).await
|
||||
}
|
||||
|
||||
pub async fn submit_with_policy(
|
||||
&self,
|
||||
prompt: &str,
|
||||
sandbox_policy: SandboxPolicy,
|
||||
) -> Result<()> {
|
||||
self.test
|
||||
.submit_turn_with_policy(prompt, sandbox_policy)
|
||||
.await
|
||||
}
|
||||
|
||||
pub async fn submit_with_permission_profile(
|
||||
&self,
|
||||
prompt: &str,
|
||||
|
||||
@@ -38,8 +38,11 @@ async fn websocket_test_codex_shell_chain() -> Result<()> {
|
||||
let mut builder = test_codex().with_windows_cmd_shell();
|
||||
|
||||
let test = builder.build_with_websocket_server(&server).await?;
|
||||
test.submit_turn_with_policy("run the echo command", test.config.legacy_sandbox_policy())
|
||||
.await?;
|
||||
test.submit_turn_with_permission_profile(
|
||||
"run the echo command",
|
||||
test.config.permissions.permission_profile(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
let connection = server.single_connection();
|
||||
assert_eq!(connection.len(), 2);
|
||||
@@ -82,7 +85,7 @@ async fn websocket_first_turn_uses_startup_prewarm_and_create() -> Result<()> {
|
||||
|
||||
let mut builder = test_codex();
|
||||
let test = builder.build_with_websocket_server(&server).await?;
|
||||
test.submit_turn_with_policy("hello", test.config.legacy_sandbox_policy())
|
||||
test.submit_turn_with_permission_profile("hello", test.config.permissions.permission_profile())
|
||||
.await?;
|
||||
|
||||
assert_eq!(server.handshakes().len(), 1);
|
||||
@@ -129,7 +132,7 @@ async fn websocket_first_turn_handles_handshake_delay_with_startup_prewarm() ->
|
||||
|
||||
let mut builder = test_codex();
|
||||
let test = builder.build_with_websocket_server(&server).await?;
|
||||
test.submit_turn_with_policy("hello", test.config.legacy_sandbox_policy())
|
||||
test.submit_turn_with_permission_profile("hello", test.config.permissions.permission_profile())
|
||||
.await?;
|
||||
|
||||
assert_eq!(server.handshakes().len(), 1);
|
||||
@@ -182,8 +185,11 @@ async fn websocket_v2_test_codex_shell_chain() -> Result<()> {
|
||||
});
|
||||
|
||||
let test = builder.build_with_websocket_server(&server).await?;
|
||||
test.submit_turn_with_policy("run the echo command", test.config.legacy_sandbox_policy())
|
||||
.await?;
|
||||
test.submit_turn_with_permission_profile(
|
||||
"run the echo command",
|
||||
test.config.permissions.permission_profile(),
|
||||
)
|
||||
.await?;
|
||||
|
||||
let connection = server.single_connection();
|
||||
assert_eq!(connection.len(), 3);
|
||||
|
||||
Reference in New Issue
Block a user