fix: 修复 beta CI 失败的两个平台/网络敏感测试

- TestSanitizePathWithSpecialChars:Windows 盘符断言按 runtime.GOOS 分支
  (Linux 下反斜杠统一为分隔符,期望 D/test/...)
- TestEnrichOneAdultScrapesArtwork:AdultProvider 改用 RoundTripper 全量
  mock,拦截所有外网请求(CI 环境可达 javdb/dmm 时会把真实封面写入
  断言导致失败);断言放宽为封面路径后缀
This commit is contained in:
truewhile
2026-09-01 14:22:52 +08:00
parent 0e73e43cbd
commit 7ac75ec69a
2 changed files with 29 additions and 11 deletions
+9 -1
View File
@@ -7,6 +7,7 @@ import (
"net/url"
"os"
"path/filepath"
"runtime"
"strings"
"sync"
"testing"
@@ -291,8 +292,15 @@ func TestSanitizePathWithSpecialChars(t *testing.T) {
}
// Test sanitizeLocalPath - Windows Drive
// sanitizeLocalPath 的盘符处理是平台相关的:Windows 保留 `D:\` 前缀,
// Linux 把反斜杠统一当作分隔符(结果等价于 D:/test/...)。
localWin := `D:\test\动漫\数码宝贝:拯救者\poster.jpg`
wantLocalWin := filepath.Join(`D:\`, "test", "动漫", "数码宝贝 拯救者", "poster.jpg")
var wantLocalWin string
if runtime.GOOS == "windows" {
wantLocalWin = filepath.Join(`D:\`, "test", "动漫", "数码宝贝 拯救者", "poster.jpg")
} else {
wantLocalWin = filepath.Join("D", "test", "动漫", "数码宝贝 拯救者", "poster.jpg")
}
if got := sanitizeLocalPath(localWin); got != wantLocalWin {
t.Errorf("sanitizeLocalPath(%q) = %q, want %q", localWin, got, wantLocalWin)
}