From d715a5ae75fd16013c3b965c317143f2a0160ef3 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sun, 8 Nov 2026 20:53:59 +0000 Subject: [PATCH] test(api): cover null milestone due_on (#40172) Removing a milestone deadline with `"due_on": null` was untested, only `""` was. On release/v28 the null case returned HTTP 500 (https://github.com/go-gitea/gitea/pull/40171). main already handles it, this adds the case to the existing test so it stays that way. --- tests/integration/api_issue_milestone_test.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/integration/api_issue_milestone_test.go b/tests/integration/api_issue_milestone_test.go index cb3f87072fd..8a49a7649c6 100644 --- a/tests/integration/api_issue_milestone_test.go +++ b/tests/integration/api_issue_milestone_test.go @@ -49,9 +49,11 @@ func TestAPIIssuesMilestone(t *testing.T) { apiMilestone2 := DecodeJSON(t, resp, &structs.Milestone{}) assert.EqualValues(t, "closed", apiMilestone2.State) - req = NewRequestWithJSON(t, "PATCH", urlStr, map[string]any{"due_on": ""}).AddTokenAuth(token) - resp = MakeRequest(t, req, http.StatusOK) - assert.Nil(t, DecodeJSON(t, resp, &structs.Milestone{}).Deadline) + for _, dueOn := range []any{"", nil} { + req = NewRequestWithJSON(t, "PATCH", urlStr, map[string]any{"due_on": dueOn}).AddTokenAuth(token) + resp = MakeRequest(t, req, http.StatusOK) + assert.Nil(t, DecodeJSON(t, resp, &structs.Milestone{}).Deadline) + } req = NewRequestWithJSON(t, "POST", fmt.Sprintf("/api/v1/repos/%s/%s/milestones", owner.Name, repo.Name), structs.CreateMilestoneOption{ Title: "wow",