feat: 新增账户资料页与头像上传
将工作人员和用户的详情、编辑改为独立账户资料页。 增加受控头像上传与读取、图片安全校验、接口测试,并优化只读及编辑布局。 同步更新平台需求、接口安全说明、项目文档和操作日志。
This commit is contained in:
25
backend/api/internal/routers/upload_test.go
Normal file
25
backend/api/internal/routers/upload_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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)
|
||||
}
|
||||
Reference in New Issue
Block a user