fix(test): assert responses timestamps and output text in finalize tests

This commit is contained in:
zhefox
2026-06-04 17:35:10 +08:00
parent fd27f55fe5
commit ebd59246a8
5 changed files with 97 additions and 2 deletions
@@ -389,6 +389,9 @@ async fn gateway_executes_openai_responses_compact_openai_family_upstream_stream
assert_eq!(response.status(), StatusCode::OK);
let response_json: serde_json::Value = response.json().await.expect("body should parse");
let created_at = response_json["created_at"]
.as_i64()
.expect("created_at should be a unix timestamp");
assert_eq!(
response_json,
json!({
@@ -396,6 +399,9 @@ async fn gateway_executes_openai_responses_compact_openai_family_upstream_stream
"object": "response",
"model": "gpt-5",
"status": "completed",
"created_at": created_at,
"completed_at": created_at,
"output_text": "Hello Compact",
"output": [{
"type": "message",
"id": "resp_compact_openai_family_123_msg",
@@ -389,6 +389,9 @@ async fn gateway_executes_openai_responses_cross_format_upstream_stream_via_loca
assert_eq!(response_status, StatusCode::OK);
let response_json: serde_json::Value =
serde_json::from_str(&response_body).expect("body should parse");
let created_at = response_json["created_at"]
.as_i64()
.expect("created_at should be a unix timestamp");
assert_eq!(
response_json,
json!({
@@ -396,6 +399,9 @@ async fn gateway_executes_openai_responses_cross_format_upstream_stream_via_loca
"object": "response",
"status": "completed",
"model": "gemini-2.5-pro-upstream",
"created_at": created_at,
"completed_at": created_at,
"output_text": "Hello Gemini CLI",
"output": [{
"type": "message",
"id": "upstream-cli-stream-123_msg",
@@ -842,6 +848,9 @@ async fn gateway_executes_openai_responses_cross_format_function_call_upstream_s
assert_eq!(response.status(), StatusCode::OK);
let response_json: serde_json::Value = response.json().await.expect("body should parse");
let created_at = response_json["created_at"]
.as_i64()
.expect("created_at should be a unix timestamp");
assert_eq!(
response_json,
json!({
@@ -849,6 +858,9 @@ async fn gateway_executes_openai_responses_cross_format_function_call_upstream_s
"object": "response",
"status": "completed",
"model": "gemini-2.5-pro-upstream",
"created_at": created_at,
"completed_at": created_at,
"output_text": "Need a tool.",
"output": [
{
"type": "message",
@@ -1412,6 +1424,9 @@ async fn gateway_executes_openai_responses_antigravity_cross_format_upstream_str
assert_eq!(response.status(), StatusCode::OK);
let response_json: serde_json::Value = response.json().await.expect("body should parse");
let created_at = response_json["created_at"]
.as_i64()
.expect("created_at should be a unix timestamp");
assert_eq!(
response_json,
json!({
@@ -1419,6 +1434,9 @@ async fn gateway_executes_openai_responses_antigravity_cross_format_upstream_str
"object": "response",
"status": "completed",
"model": "claude-sonnet-4-5",
"created_at": created_at,
"completed_at": created_at,
"output_text": "Hello Antigravity",
"output": [{
"type": "message",
"id": "resp-local-stream_msg",
@@ -405,6 +405,9 @@ async fn gateway_executes_openai_responses_sync_upstream_stream_via_local_finali
assert_eq!(response.status(), StatusCode::OK);
let response_json: serde_json::Value = response.json().await.expect("body should parse");
let created_at = response_json["created_at"]
.as_i64()
.expect("created_at should be a unix timestamp");
assert_eq!(
response_json,
json!({
@@ -412,6 +415,9 @@ async fn gateway_executes_openai_responses_sync_upstream_stream_via_local_finali
"object": "response",
"model": "gpt-5-upstream",
"status": "completed",
"created_at": created_at,
"completed_at": created_at,
"output_text": "Hello",
"output": [{
"type": "message",
"id": "resp_stream_001_msg",