Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

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

buua43631f26a2b0c9b
diff --git a/internal/handler/agent_version_catalog_test.go b/internal/handler/agent_version_catalog_test.go
index 355b4a1fb7..902d32b8bb 100644
--- a/internal/handler/agent_version_catalog_test.go
+++ b/internal/handler/agent_version_catalog_test.go
@@ -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"`