mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-06 17:37:47 +08:00
- 移除 upstream_base_url 参数及 AETHER_GATEWAY_UPSTREAM 环境变量,gateway 不再需要指向 Python 宿主 - 删除所有 LEGACY_*/PYTHON_* 常量、路由组、header 定义及 sunset/phaseout 机制 - 将 legacy_gateway_bridge 重命名为 internal_gateway,executor 相关命名统一为 execution_runtime - dev.sh 新增 Postgres/Redis 预检查,移除 upstream 相关启动参数和提示 - 新增 ai_public 路由处理器 - 全量适配 handler、test、state、control 等模块的命名和接口变更
99 lines
3.6 KiB
Rust
99 lines
3.6 KiB
Rust
use http::Uri;
|
|
|
|
use super::{classify_control_route, headers};
|
|
|
|
#[test]
|
|
fn classifies_admin_video_tasks_list_as_admin_proxy_route() {
|
|
let headers = headers(&[]);
|
|
let uri: Uri = "/api/admin/video-tasks?status=completed&page=2"
|
|
.parse()
|
|
.expect("uri should parse");
|
|
let decision =
|
|
classify_control_route(&http::Method::GET, &uri, &headers).expect("route should classify");
|
|
|
|
assert_eq!(decision.route_class.as_deref(), Some("admin_proxy"));
|
|
assert_eq!(decision.route_family.as_deref(), Some("video_tasks_manage"));
|
|
assert_eq!(decision.route_kind.as_deref(), Some("list_tasks"));
|
|
assert_eq!(
|
|
decision.auth_endpoint_signature.as_deref(),
|
|
Some("admin:video_tasks")
|
|
);
|
|
assert!(!decision.is_execution_runtime_candidate());
|
|
}
|
|
|
|
#[test]
|
|
fn classifies_admin_video_tasks_stats_as_admin_proxy_route() {
|
|
let headers = headers(&[]);
|
|
let uri: Uri = "/api/admin/video-tasks/stats"
|
|
.parse()
|
|
.expect("uri should parse");
|
|
let decision =
|
|
classify_control_route(&http::Method::GET, &uri, &headers).expect("route should classify");
|
|
|
|
assert_eq!(decision.route_class.as_deref(), Some("admin_proxy"));
|
|
assert_eq!(decision.route_family.as_deref(), Some("video_tasks_manage"));
|
|
assert_eq!(decision.route_kind.as_deref(), Some("stats"));
|
|
assert_eq!(
|
|
decision.auth_endpoint_signature.as_deref(),
|
|
Some("admin:video_tasks")
|
|
);
|
|
assert!(!decision.is_execution_runtime_candidate());
|
|
}
|
|
|
|
#[test]
|
|
fn classifies_admin_video_tasks_detail_as_admin_proxy_route() {
|
|
let headers = headers(&[]);
|
|
let uri: Uri = "/api/admin/video-tasks/task-123"
|
|
.parse()
|
|
.expect("uri should parse");
|
|
let decision =
|
|
classify_control_route(&http::Method::GET, &uri, &headers).expect("route should classify");
|
|
|
|
assert_eq!(decision.route_class.as_deref(), Some("admin_proxy"));
|
|
assert_eq!(decision.route_family.as_deref(), Some("video_tasks_manage"));
|
|
assert_eq!(decision.route_kind.as_deref(), Some("detail"));
|
|
assert_eq!(
|
|
decision.auth_endpoint_signature.as_deref(),
|
|
Some("admin:video_tasks")
|
|
);
|
|
assert!(!decision.is_execution_runtime_candidate());
|
|
}
|
|
|
|
#[test]
|
|
fn classifies_admin_video_tasks_cancel_as_admin_proxy_route() {
|
|
let headers = headers(&[]);
|
|
let uri: Uri = "/api/admin/video-tasks/task-123/cancel"
|
|
.parse()
|
|
.expect("uri should parse");
|
|
let decision =
|
|
classify_control_route(&http::Method::POST, &uri, &headers).expect("route should classify");
|
|
|
|
assert_eq!(decision.route_class.as_deref(), Some("admin_proxy"));
|
|
assert_eq!(decision.route_family.as_deref(), Some("video_tasks_manage"));
|
|
assert_eq!(decision.route_kind.as_deref(), Some("cancel"));
|
|
assert_eq!(
|
|
decision.auth_endpoint_signature.as_deref(),
|
|
Some("admin:video_tasks")
|
|
);
|
|
assert!(!decision.is_execution_runtime_candidate());
|
|
}
|
|
|
|
#[test]
|
|
fn classifies_admin_video_tasks_video_as_admin_proxy_route() {
|
|
let headers = headers(&[]);
|
|
let uri: Uri = "/api/admin/video-tasks/task-123/video"
|
|
.parse()
|
|
.expect("uri should parse");
|
|
let decision =
|
|
classify_control_route(&http::Method::GET, &uri, &headers).expect("route should classify");
|
|
|
|
assert_eq!(decision.route_class.as_deref(), Some("admin_proxy"));
|
|
assert_eq!(decision.route_family.as_deref(), Some("video_tasks_manage"));
|
|
assert_eq!(decision.route_kind.as_deref(), Some("video"));
|
|
assert_eq!(
|
|
decision.auth_endpoint_signature.as_deref(),
|
|
Some("admin:video_tasks")
|
|
);
|
|
assert!(!decision.is_execution_runtime_candidate());
|
|
}
|