diff options
author | 6543 <6543@obermui.de> | 2020-07-28 13:30:40 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-28 12:30:40 +0100 |
commit | 8bdc9795d8a5aa51bc1295dd1cf57006a5873343 (patch) | |
tree | 81ebd17da66318ca7909284021319be10a552e5c /integrations | |
parent | 78cbd0ca72619a25849edc3460ec0c492b838a59 (diff) | |
download | gitea-8bdc9795d8a5aa51bc1295dd1cf57006a5873343.tar.gz gitea-8bdc9795d8a5aa51bc1295dd1cf57006a5873343.zip |
Add name filter to API for GetMilestoneList (#12336)
Adds a name filter to the API for GetMilestoneList
Includes a small refactor: merge GetMilestones and GetMilestonesByRepoID
Close #12260
Needed for https://gitea.com/gitea/go-sdk/issues/383 and https://gitea.com/gitea/tea/pulls/149
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/api_issue_milestone_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/integrations/api_issue_milestone_test.go b/integrations/api_issue_milestone_test.go index f1f306b768..4cc574b9eb 100644 --- a/integrations/api_issue_milestone_test.go +++ b/integrations/api_issue_milestone_test.go @@ -55,6 +55,18 @@ func TestAPIIssuesMilestone(t *testing.T) { assert.Equal(t, "wow", apiMilestone.Title) assert.Equal(t, structs.StateClosed, apiMilestone.State) + var apiMilestones []structs.Milestone + req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/milestones?state=%s&token=%s", owner.Name, repo.Name, "all", token)) + resp = session.MakeRequest(t, req, http.StatusOK) + DecodeJSON(t, resp, &apiMilestones) + assert.Len(t, apiMilestones, 4) + + req = NewRequest(t, "GET", fmt.Sprintf("/api/v1/repos/%s/%s/milestones?state=%s&name=%s&token=%s", owner.Name, repo.Name, "all", "milestone2", token)) + resp = session.MakeRequest(t, req, http.StatusOK) + DecodeJSON(t, resp, &apiMilestones) + assert.Len(t, apiMilestones, 1) + assert.Equal(t, int64(2), apiMilestones[0].ID) + req = NewRequest(t, "DELETE", fmt.Sprintf("/api/v1/repos/%s/%s/milestones/%d?token=%s", owner.Name, repo.Name, apiMilestone.ID, token)) resp = session.MakeRequest(t, req, http.StatusNoContent) } |