From 826f79ca80ade34ec33facccda2a7f31e7abf631 Mon Sep 17 00:00:00 2001 From: xuans Date: Mon, 31 Aug 2026 02:35:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A1=A5=E5=85=85=E5=9F=9F=E5=90=8D=E4=BB=93?= =?UTF-8?q?=E5=82=A8=E7=BC=BA=E5=A4=B1=E5=9B=9E=E5=BD=92=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/internal/httpapi/server_test.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/backend/internal/httpapi/server_test.go b/backend/internal/httpapi/server_test.go index 3d4f452..3f7d94b 100644 --- a/backend/internal/httpapi/server_test.go +++ b/backend/internal/httpapi/server_test.go @@ -634,3 +634,19 @@ func TestProxyModeAcceptsHTTPSSameOrigin(t *testing.T) { t.Fatal("高级 HTTPS 模式应接受反向代理后的同源 HTTPS 请求") } } + +func TestDomainAPIReportsMissingRepository(t *testing.T) { + cfg := readyTestConfig(t.TempDir()) + server := New(Dependencies{Config: cfg}) + + request := httptest.NewRequest(http.MethodGet, "/api/v1/domains", nil) + response := httptest.NewRecorder() + serveAdminHTTP(server, response, request) + + if response.Code != http.StatusNotImplemented { + t.Fatalf("域名仓储未配置时应返回 501:%d %s", response.Code, response.Body.String()) + } + if !strings.Contains(response.Body.String(), "域名管理接口尚未配置") { + t.Fatalf("缺少域名仓储错误提示:%s", response.Body.String()) + } +}