tests: replace mount_sse_once_match with mount_sse_once for SSE mocking (#6640)

This commit is contained in:
pakrym-oai
2025-11-13 18:04:05 -08:00
committed by GitHub
parent 2a6e9b20df
commit 6c384eb9c6
17 changed files with 85 additions and 142 deletions

View File

@@ -18,7 +18,7 @@ use core_test_support::responses::ev_reasoning_text_delta;
use core_test_support::responses::ev_response_created;
use core_test_support::responses::ev_web_search_call_added;
use core_test_support::responses::ev_web_search_call_done;
use core_test_support::responses::mount_sse_once_match;
use core_test_support::responses::mount_sse_once;
use core_test_support::responses::sse;
use core_test_support::responses::start_mock_server;
use core_test_support::skip_if_no_network;
@@ -26,7 +26,6 @@ use core_test_support::test_codex::TestCodex;
use core_test_support::test_codex::test_codex;
use core_test_support::wait_for_event_match;
use pretty_assertions::assert_eq;
use wiremock::matchers::any;
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn user_message_item_is_emitted() -> anyhow::Result<()> {
@@ -37,7 +36,7 @@ async fn user_message_item_is_emitted() -> anyhow::Result<()> {
let TestCodex { codex, .. } = test_codex().build(&server).await?;
let first_response = sse(vec![ev_response_created("resp-1"), ev_completed("resp-1")]);
mount_sse_once_match(&server, any(), first_response).await;
mount_sse_once(&server, first_response).await;
codex
.submit(Op::UserInput {
@@ -93,7 +92,7 @@ async fn assistant_message_item_is_emitted() -> anyhow::Result<()> {
ev_assistant_message("msg-1", "all done"),
ev_completed("resp-1"),
]);
mount_sse_once_match(&server, any(), first_response).await;
mount_sse_once(&server, first_response).await;
codex
.submit(Op::UserInput {
@@ -149,7 +148,7 @@ async fn reasoning_item_is_emitted() -> anyhow::Result<()> {
reasoning_item,
ev_completed("resp-1"),
]);
mount_sse_once_match(&server, any(), first_response).await;
mount_sse_once(&server, first_response).await;
codex
.submit(Op::UserInput {
@@ -207,7 +206,7 @@ async fn web_search_item_is_emitted() -> anyhow::Result<()> {
web_search_done,
ev_completed("resp-1"),
]);
mount_sse_once_match(&server, any(), first_response).await;
mount_sse_once(&server, first_response).await;
codex
.submit(Op::UserInput {
@@ -259,7 +258,7 @@ async fn agent_message_content_delta_has_item_metadata() -> anyhow::Result<()> {
ev_assistant_message("msg-1", "streamed response"),
ev_completed("resp-1"),
]);
mount_sse_once_match(&server, any(), stream).await;
mount_sse_once(&server, stream).await;
codex
.submit(Op::UserInput {
@@ -324,7 +323,7 @@ async fn reasoning_content_delta_has_item_metadata() -> anyhow::Result<()> {
ev_reasoning_item("reasoning-1", &["step one"], &[]),
ev_completed("resp-1"),
]);
mount_sse_once_match(&server, any(), stream).await;
mount_sse_once(&server, stream).await;
codex
.submit(Op::UserInput {
@@ -381,7 +380,7 @@ async fn reasoning_raw_content_delta_respects_flag() -> anyhow::Result<()> {
ev_reasoning_item("reasoning-raw", &["complete"], &["raw detail"]),
ev_completed("resp-1"),
]);
mount_sse_once_match(&server, any(), stream).await;
mount_sse_once(&server, stream).await;
codex
.submit(Op::UserInput {