feat: 首页改版与 uv / 镜像配置收敛,精简任务数据结构
- 页头只保留品牌与操作图标,三栏改为 1:2:1、容器最宽 1320 - 任务卡片:状态标签移入标题行并缩小,隐藏任务标识,操作行贴内容底边 - uv 配置弹窗:删掉与首页重复的状态条,三段配置改成标签页 - 镜像源:弹窗去掉默认镜像汇总,首页卡片改为展示默认镜像与运行时注入的变量 - 后端:迁移合并为单一基线 0001_init,删掉未生效的 concurrency_policy / retry_*, 运行触发只剩 schedule / manual;contracts、前端生成类型、README / PLAN 同步
This commit is contained in:
@@ -197,6 +197,81 @@ async fn uv_settings_mutations_require_token() {
|
||||
assert_eq!(body["code"], "FORBIDDEN");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn uv_mirror_is_saved_with_the_settings_and_drives_both_urls() {
|
||||
let (app, _temp_dir) = test_app().await;
|
||||
let token = auth_token(&app).await;
|
||||
|
||||
let (status, body) = send_json(&app, Method::GET, "/api/v1/uv", None, None).await;
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
assert_eq!(
|
||||
body["mirror_url"],
|
||||
"https://mirrors.ustc.edu.cn/github-release"
|
||||
);
|
||||
assert_eq!(
|
||||
body["uv_download_url"],
|
||||
"https://mirrors.ustc.edu.cn/github-release/astral-sh/uv/LatestRelease"
|
||||
);
|
||||
assert_eq!(
|
||||
body["python_mirror_url"],
|
||||
"https://mirrors.ustc.edu.cn/github-release/astral-sh/python-build-standalone/releases/download"
|
||||
);
|
||||
// 解释器镜像作为默认环境变量出现在列表里,可以被显式覆盖
|
||||
assert_eq!(
|
||||
body["env_defaults"]["UV_PYTHON_INSTALL_MIRROR"],
|
||||
"https://mirrors.ustc.edu.cn/github-release/astral-sh/python-build-standalone/releases/download"
|
||||
);
|
||||
|
||||
// 非法镜像地址会被拒绝
|
||||
let (status, body) = send_json(
|
||||
&app,
|
||||
Method::PUT,
|
||||
"/api/v1/uv",
|
||||
Some(&token),
|
||||
Some(json!({
|
||||
"source": "managed",
|
||||
"mirror_url": "ftp://mirror.example"
|
||||
})),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(status, StatusCode::BAD_REQUEST);
|
||||
assert_eq!(body["field"], "url");
|
||||
|
||||
// 保存自定义镜像:两个下载地址都由它派生
|
||||
let (status, saved) = send_json(
|
||||
&app,
|
||||
Method::PUT,
|
||||
"/api/v1/uv",
|
||||
Some(&token),
|
||||
Some(json!({
|
||||
"source": "managed",
|
||||
"mirror_url": "https://mirror.example/github-release/"
|
||||
})),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
assert_eq!(saved["mirror_url"], "https://mirror.example/github-release");
|
||||
assert_eq!(
|
||||
saved["uv_download_url"],
|
||||
"https://mirror.example/github-release/astral-sh/uv/LatestRelease"
|
||||
);
|
||||
|
||||
// 传 null 恢复内置默认
|
||||
let (status, restored) = send_json(
|
||||
&app,
|
||||
Method::PUT,
|
||||
"/api/v1/uv",
|
||||
Some(&token),
|
||||
Some(json!({ "source": "managed", "mirror_url": null })),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
assert_eq!(
|
||||
restored["mirror_url"],
|
||||
"https://mirrors.ustc.edu.cn/github-release"
|
||||
);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn uv_download_requires_token() {
|
||||
let (app, _temp_dir) = test_app().await;
|
||||
|
||||
Reference in New Issue
Block a user