mirror of
https://github.com/go-gitea/gitea.git
synced 2026-11-09 17:37:20 -06:00
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.
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user