fix: align version catalog test with EE permissions (#22011)

This commit is contained in:
buua436 authored and GitHub committed 2026-11-05 11:21:16 +08:00
1 parent 6fd888fc0b
commit 31f26a2b0c
1 file changed
+7 -1
@@ -28,6 +28,8 @@ import (
"ragflow/internal/common"
"ragflow/internal/entity"
"ragflow/internal/permission"
"ragflow/internal/permission/testsupport"
"ragflow/internal/service"
)
@@ -163,8 +165,9 @@ func TestListVersionCatalogEmpty(t *testing.T) {
func TestListVersionCatalogSharedPipeline(t *testing.T) {
c, w, db := setupGinContextWithUserAndDB(t, "GET", "/api/v1/agents/versions?category=dataflow")
c.Request = c.Request.WithContext(permission.WithIdentity(c.Request.Context(), "user-1", "team"))
if err := db.Create(&entity.UserTenant{
ID: "membership", UserID: "user-1", TenantID: "team", Role: "normal",
ID: "membership", UserID: "user-1", TenantID: "team", Role: "normal", Status: sptr(string(entity.TenantMembershipStatusJoined)),
}).Error; err != nil {
t.Fatal(err)
}
@@ -175,6 +178,9 @@ func TestListVersionCatalogSharedPipeline(t *testing.T) {
if err := db.Create(&canvases).Error; err != nil {
t.Fatal(err)
}
if err := testsupport.PrepareEnterprisePermissionFixture(db, "team"); err != nil {
t.Fatal(err)
}
(&AgentHandler{agentService: service.NewAgentService()}).ListVersionCatalog(c)
var response struct {
Code common.ErrorCode `json:"code"`