支持项目编码访问单项目公示屏
需求:无需查询公示 Token,直接通过项目编码打开单项目公示页。 实现:规范化项目编码并按 code 查询,同时保留既有 Token 哈希查询;补充前后端及集成回归测试。
This commit is contained in:
@@ -158,6 +158,22 @@ func TestCurrentDayViewsIgnoreYesterdayRunningSessionPostgresIntegration(t *test
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("display by project code", func(t *testing.T) {
|
||||
recorder := httptest.NewRecorder()
|
||||
request := httptest.NewRequest(http.MethodGet, "/api/display/"+strings.ToLower(project.Code)+"/snapshot", nil)
|
||||
server.Handler().ServeHTTP(recorder, request)
|
||||
if recorder.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d, body = %s", recorder.Code, recorder.Body.String())
|
||||
}
|
||||
var response displaySnapshotDTO
|
||||
if err := json.Unmarshal(recorder.Body.Bytes(), &response); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if response.Project.ID != project.ID {
|
||||
t.Fatalf("project = %q, want %q", response.Project.ID, project.ID)
|
||||
}
|
||||
})
|
||||
|
||||
t.Run("admin project", func(t *testing.T) {
|
||||
projection, _, _, _, _, err := server.adminProjectProjection(context.Background(), project)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user