refactor(api): the cover-source and tag-source admin cards share their handlers (#8002)
release / web (push) Successful in 1m16s
release / go (push) Successful in 1m49s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 3m56s
release / android (push) Successful in 4m8s
release / Build signed APK (push) Successful in 4m29s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 13s
release / Verify release artifacts (tag releases only) (push) Skipped
release / web (push) Successful in 1m16s
release / go (push) Successful in 1m49s
release / govulncheck (push) Successful in 20s
release / integration (push) Successful in 3m56s
release / android (push) Successful in 4m8s
release / Build signed APK (push) Successful in 4m29s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 13s
release / Verify release artifacts (tag releases only) (push) Skipped
admin_cover_sources.go and admin_tag_sources.go were the same list, update and test handlers over two settings services, each with its own copy of the response mapping. With both services now a providers.Service, admin_provider_sources.go holds the handlers and wire types once, and each family's routes pass their own service. The wire shape is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -86,7 +86,7 @@ func TestAdminListCoverSources_ReturnsRegisteredProviders(t *testing.T) {
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d, want 200; body=%s", rec.Code, rec.Body.String())
|
||||
}
|
||||
var resp coverProvidersListResp
|
||||
var resp providerSourcesListResp
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
|
||||
t.Fatalf("decode: %v", err)
|
||||
}
|
||||
@@ -132,7 +132,7 @@ func TestAdminUpdateCoverSource_FlippingEnabledBumpsVersion(t *testing.T) {
|
||||
admin := seedUser(t, h.pool, "csflip", "pw", true)
|
||||
|
||||
disabled := false
|
||||
body, _ := json.Marshal(updateCoverSourceReq{Enabled: &disabled})
|
||||
body, _ := json.Marshal(updateProviderSourceReq{Enabled: &disabled})
|
||||
req := httptest.NewRequest(http.MethodPatch, "/api/admin/cover-sources/flip-prov", bytes.NewReader(body))
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req = withUser(req, admin)
|
||||
@@ -142,7 +142,7 @@ func TestAdminUpdateCoverSource_FlippingEnabledBumpsVersion(t *testing.T) {
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d, want 200; body=%s", rec.Code, rec.Body.String())
|
||||
}
|
||||
var resp updateCoverSourceResp
|
||||
var resp updateProviderSourceResp
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
|
||||
t.Fatalf("decode: %v", err)
|
||||
}
|
||||
@@ -164,7 +164,7 @@ func TestAdminUpdateCoverSource_KeyOnlyDoesNotBump(t *testing.T) {
|
||||
admin := seedUser(t, h.pool, "cskey", "pw", true)
|
||||
|
||||
newKey := "newkey"
|
||||
body, _ := json.Marshal(updateCoverSourceReq{APIKey: &newKey})
|
||||
body, _ := json.Marshal(updateProviderSourceReq{APIKey: &newKey})
|
||||
req := httptest.NewRequest(http.MethodPatch, "/api/admin/cover-sources/key-prov", bytes.NewReader(body))
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req = withUser(req, admin)
|
||||
@@ -174,7 +174,7 @@ func TestAdminUpdateCoverSource_KeyOnlyDoesNotBump(t *testing.T) {
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d, want 200; body=%s", rec.Code, rec.Body.String())
|
||||
}
|
||||
var resp updateCoverSourceResp
|
||||
var resp updateProviderSourceResp
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
|
||||
t.Fatalf("decode: %v", err)
|
||||
}
|
||||
@@ -197,7 +197,7 @@ func TestAdminUpdateCoverSource_UnknownProvider404(t *testing.T) {
|
||||
h, _ := testHandlersWithCoverSettings(t)
|
||||
admin := seedUser(t, h.pool, "cs404", "pw", true)
|
||||
|
||||
body, _ := json.Marshal(updateCoverSourceReq{})
|
||||
body, _ := json.Marshal(updateProviderSourceReq{})
|
||||
req := httptest.NewRequest(http.MethodPatch, "/api/admin/cover-sources/missing", bytes.NewReader(body))
|
||||
req.Header.Set("Content-Type", "application/json")
|
||||
req = withUser(req, admin)
|
||||
@@ -252,7 +252,7 @@ func TestAdminTestCoverSource_NotTestableReturnsOkFalse(t *testing.T) {
|
||||
if rec.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d, want 200; body=%s", rec.Code, rec.Body.String())
|
||||
}
|
||||
var resp testCoverSourceResp
|
||||
var resp testProviderSourceResp
|
||||
if err := json.Unmarshal(rec.Body.Bytes(), &resp); err != nil {
|
||||
t.Fatalf("decode: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user