Files
platforms/backend/api/internal/routers/upload_test.go
czl231 7242048abf feat: 新增账户资料页与头像上传
将工作人员和用户的详情、编辑改为独立账户资料页。

增加受控头像上传与读取、图片安全校验、接口测试,并优化只读及编辑布局。

同步更新平台需求、接口安全说明、项目文档和操作日志。
2026-08-10 22:35:47 +08:00

26 lines
760 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Package routers 测试受鉴权上传端点的路由注册。
// 版本v1.0.0
package routers
import (
"net/http"
"testing"
"github.com/gin-gonic/gin"
)
// TestUploadRoutesExposeDedicatedAvatarEndpoint 验证专用头像上传路由已注册且不改变原文件上传路由。
func TestUploadRoutesExposeDedicatedAvatarEndpoint(t *testing.T) {
engine := gin.New()
registerUploadRoute("heqi", engine)
routes := make(map[string]map[string]bool)
for _, route := range engine.Routes() {
if routes[route.Path] == nil {
routes[route.Path] = make(map[string]bool)
}
routes[route.Path][route.Method] = true
}
assertRouteMethods(t, routes, "/upload/file", http.MethodPost)
assertRouteMethods(t, routes, "/upload/avatar", http.MethodPost)
}