test(swarm): adapter 用例走 admin 旁路通过蜂群订阅 gate

PR#70 给 AgentCreateUserSwarm 加了订阅 gate 后,TestAgentUserSwarmsAdapter
CreatesScopedDeployment(普通用户、无订阅)被 POLICY_REJECTED。该用例聚焦
adapter 的用户作用域而非 gate 本身(gate 由 TestGetUserSwarmEnabled 覆盖),
故走 admin 旁路。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-11 18:28:37 +08:00
co-authored by Claude Opus 4.8
parent a0616eaebf
commit c55e60b3b3
@@ -1008,6 +1008,9 @@ func TestAgentUserSwarmsAdapterCreatesScopedDeployment(t *testing.T) {
recorder := httptest.NewRecorder()
ctx, _ := gin.CreateTestContext(recorder)
ctx.Set("id", 7)
// 蜂群订阅 gate(PR#70):普通用户须有开通蜂群的活跃套餐;admin 绕过(便于测试/运维)。
// 本用例聚焦 adapter 的用户作用域,非 gate 本身(gate 见 TestGetUserSwarmEnabled),走 admin 旁路。
ctx.Set("role", common.RoleAdminUser)
ctx.Set("group", "development")
ctx.Request = httptest.NewRequest(http.MethodPost, "/api/swarms", strings.NewReader(string(body)))
ctx.Request.Header.Set("Content-Type", "application/json")