更新权限回归测试会话角色

将续期和阿里云 DNS 安全报告测试切换为超级管理员会话,匹配接口收紧后的权限边界。
This commit is contained in:
xuans 2026-09-29 22:41:26 +08:00
parent 5a1c3dc678
commit 853a7cdcf1
2 changed files with 3 additions and 3 deletions

View File

@ -113,7 +113,7 @@ func TestAliyunDomainCheckUsesOnlyCurrentTargetAndProtectsPCUX(t *testing.T) {
w := httptest.NewRecorder()
body := strings.NewReader(`{"domain":"solit.cn"}`)
req := httptest.NewRequest(http.MethodPost, "/api/v1/dns/aliyun/check", body)
serveAdminHTTP(server, w, req)
serveSuperAdminHTTP(server, w, req)
if w.Code != http.StatusOK {
t.Fatalf("POST check solit.cn status = %d; body=%s", w.Code, w.Body.String())
}

View File

@ -20,7 +20,7 @@ func TestRenewalReportHidesNestedWorkflowErrors(t *testing.T) {
},
})
response := httptest.NewRecorder()
serveAdminHTTP(server, response, httptest.NewRequest(http.MethodPost, "/api/v1/renewal/run", nil))
serveSuperAdminHTTP(server, response, httptest.NewRequest(http.MethodPost, "/api/v1/renewal/run", nil))
if response.Code != http.StatusOK || strings.Contains(response.Body.String(), "internal-secret-sentinel") {
t.Fatalf("续期报告不得返回底层敏感错误:%d", response.Code)
}
@ -50,7 +50,7 @@ func TestAliyunReportHidesSDKErrorAndPreservesCleanupFailure(t *testing.T) {
Secrets: &fakeSecretReaderStore{data: map[string]map[string]string{cfg.DNS.CredentialRef: {"access_key_id": "test-id", "access_key_secret": "test-secret", "managed_zones": "example.test", "allowed_domains": "example.test"}}},
})
response := httptest.NewRecorder()
serveAdminHTTP(server, response, httptest.NewRequest(http.MethodPost, "/api/v1/dns/aliyun/check", strings.NewReader(`{"domain":"example.test"}`)))
serveSuperAdminHTTP(server, response, httptest.NewRequest(http.MethodPost, "/api/v1/dns/aliyun/check", strings.NewReader(`{"domain":"example.test"}`)))
body := response.Body.String()
if response.Code != http.StatusOK || strings.Contains(body, "internal-secret-sentinel") {
t.Fatalf("阿里云验证报告不得返回 SDK 敏感错误:%d", response.Code)