mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-04 16:37:46 +08:00
Merge upstream main
This commit is contained in:
@@ -1107,7 +1107,8 @@ async fn gateway_routes_openai_responses_stream_image_intent_to_openai_image_pla
|
||||
assert_eq!(seen_plan.auth_header, "Bearer sk-upstream-image-bridge");
|
||||
assert_eq!(seen_plan.body_json["stream"], true);
|
||||
assert_eq!(seen_plan.body_json["input"], "Draw a mountain observatory");
|
||||
assert!(seen_plan.body_json.get("tools").is_none());
|
||||
assert_eq!(seen_plan.body_json["tools"][0]["type"], "image_generation");
|
||||
assert_eq!(seen_plan.body_json["tools"][0]["size"], "1024x1024");
|
||||
|
||||
gateway_handle.abort();
|
||||
execution_runtime_handle.abort();
|
||||
|
||||
@@ -1490,7 +1490,24 @@ async fn gateway_verifies_admin_provider_ops_locally_for_new_api_with_trusted_ad
|
||||
.and_then(|value| value.to_str().ok()),
|
||||
Some("session=foo")
|
||||
);
|
||||
assert!(headers.contains_key("sec-ch-ua"));
|
||||
assert_eq!(
|
||||
headers
|
||||
.get(axum::http::header::USER_AGENT)
|
||||
.and_then(|value| value.to_str().ok()),
|
||||
Some("cc-switch/1.0")
|
||||
);
|
||||
assert_eq!(
|
||||
headers
|
||||
.get(axum::http::header::CONTENT_TYPE)
|
||||
.and_then(|value| value.to_str().ok()),
|
||||
Some("application/json")
|
||||
);
|
||||
assert_eq!(
|
||||
headers
|
||||
.get(axum::http::header::ACCEPT)
|
||||
.and_then(|value| value.to_str().ok()),
|
||||
Some("application/json")
|
||||
);
|
||||
let mut encoder = GzEncoder::new(Vec::new(), Compression::default());
|
||||
encoder
|
||||
.write_all(
|
||||
|
||||
@@ -300,7 +300,11 @@ async fn gateway_handles_admin_users_root_locally_with_trusted_admin_principal()
|
||||
|
||||
assert_eq!(response.status(), StatusCode::OK);
|
||||
let payload: serde_json::Value = response.json().await.expect("json body should parse");
|
||||
let items = payload.as_array().expect("list payload should be array");
|
||||
assert_eq!(payload["total"], 1);
|
||||
assert_eq!(payload["skip"], 0);
|
||||
assert_eq!(payload["limit"], 20);
|
||||
assert_eq!(payload["has_more"], false);
|
||||
let items = payload["items"].as_array().expect("items should be array");
|
||||
assert_eq!(items.len(), 1);
|
||||
assert_eq!(items[0]["id"], "user-1");
|
||||
assert_eq!(items[0]["email"], "[email protected]");
|
||||
@@ -332,9 +336,10 @@ async fn gateway_handles_admin_users_root_locally_with_trusted_admin_principal()
|
||||
.json()
|
||||
.await
|
||||
.expect("search json body should parse");
|
||||
let search_items = search_payload
|
||||
assert_eq!(search_payload["total"], 1);
|
||||
let search_items = search_payload["items"]
|
||||
.as_array()
|
||||
.expect("search list payload should be array");
|
||||
.expect("search items should be array");
|
||||
assert_eq!(search_items.len(), 1);
|
||||
assert_eq!(search_items[0]["id"], "user-3");
|
||||
assert_eq!(search_items[0]["email"], "[email protected]");
|
||||
@@ -355,9 +360,10 @@ async fn gateway_handles_admin_users_root_locally_with_trusted_admin_principal()
|
||||
.json()
|
||||
.await
|
||||
.expect("id search json body should parse");
|
||||
let id_search_items = id_search_payload
|
||||
assert_eq!(id_search_payload["total"], 1);
|
||||
let id_search_items = id_search_payload["items"]
|
||||
.as_array()
|
||||
.expect("id search list payload should be array");
|
||||
.expect("id search items should be array");
|
||||
assert_eq!(id_search_items.len(), 1);
|
||||
assert_eq!(id_search_items[0]["id"], "user-3");
|
||||
|
||||
@@ -377,9 +383,11 @@ async fn gateway_handles_admin_users_root_locally_with_trusted_admin_principal()
|
||||
.json()
|
||||
.await
|
||||
.expect("limited search json body should parse");
|
||||
let limited_search_items = limited_search_payload
|
||||
assert_eq!(limited_search_payload["total"], 3);
|
||||
assert_eq!(limited_search_payload["has_more"], true);
|
||||
let limited_search_items = limited_search_payload["items"]
|
||||
.as_array()
|
||||
.expect("limited search list payload should be array");
|
||||
.expect("limited search items should be array");
|
||||
assert_eq!(limited_search_items.len(), 2);
|
||||
|
||||
assert_eq!(*upstream_hits.lock().expect("mutex should lock"), 0);
|
||||
@@ -1057,7 +1065,8 @@ async fn gateway_handles_admin_users_root_locally_with_bearer_admin_session() {
|
||||
|
||||
assert_eq!(response.status(), StatusCode::OK);
|
||||
let payload: serde_json::Value = response.json().await.expect("json body should parse");
|
||||
let items = payload.as_array().expect("list payload should be array");
|
||||
assert_eq!(payload["total"], 1);
|
||||
let items = payload["items"].as_array().expect("items should be array");
|
||||
assert_eq!(items.len(), 1);
|
||||
assert_eq!(items[0]["id"], "user-1");
|
||||
assert_eq!(items[0]["email"], "[email protected]");
|
||||
|
||||
@@ -4378,7 +4378,7 @@ async fn gateway_handles_wallet_balance_locally_without_proxying_upstream() {
|
||||
#[tokio::test]
|
||||
async fn gateway_handles_wallet_today_cost_locally_without_proxying_upstream() {
|
||||
let auth_now = Utc::now();
|
||||
let usage_now = auth_now - chrono::Duration::minutes(30);
|
||||
let usage_now = auth_now;
|
||||
let user = sample_auth_user(auth_now);
|
||||
let access_token = build_test_auth_token(
|
||||
"access",
|
||||
|
||||
Reference in New Issue
Block a user