diff options
author | Jimmy Praet <jimmy.praet@telenet.be> | 2021-08-13 22:47:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-13 22:47:25 +0200 |
commit | a4962a944002c3d3949520949f964aae7ff478ed (patch) | |
tree | e9e82d3fd7e88092577610f067c4befbd1550162 /integrations | |
parent | 3a6edd36851b266612f3d325bebc716fc60bfed5 (diff) | |
download | gitea-a4962a944002c3d3949520949f964aae7ff478ed.tar.gz gitea-a4962a944002c3d3949520949f964aae7ff478ed.zip |
Add filter by owner and team to issue/pulls search endpoint (#16662)
* Filter by owner and team in API issue/pulls search
* Add integration test
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/api_issue_test.go | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/integrations/api_issue_test.go b/integrations/api_issue_test.go index 74512cafa3..245ab76c7b 100644 --- a/integrations/api_issue_test.go +++ b/integrations/api_issue_test.go @@ -206,7 +206,7 @@ func TestAPISearchIssues(t *testing.T) { req = NewRequest(t, "GET", link.String()) resp = session.MakeRequest(t, req, http.StatusOK) DecodeJSON(t, resp, &apiIssues) - assert.EqualValues(t, "14", resp.Header().Get("X-Total-Count")) + assert.EqualValues(t, "15", resp.Header().Get("X-Total-Count")) assert.Len(t, apiIssues, 10) //there are more but 10 is page item limit query.Add("limit", "20") @@ -214,7 +214,7 @@ func TestAPISearchIssues(t *testing.T) { req = NewRequest(t, "GET", link.String()) resp = session.MakeRequest(t, req, http.StatusOK) DecodeJSON(t, resp, &apiIssues) - assert.Len(t, apiIssues, 14) + assert.Len(t, apiIssues, 15) query = url.Values{"assigned": {"true"}, "state": {"all"}} link.RawQuery = query.Encode() @@ -236,6 +236,27 @@ func TestAPISearchIssues(t *testing.T) { resp = session.MakeRequest(t, req, http.StatusOK) DecodeJSON(t, resp, &apiIssues) assert.Len(t, apiIssues, 2) + + query = url.Values{"owner": {"user2"}} // user + link.RawQuery = query.Encode() + req = NewRequest(t, "GET", link.String()) + resp = session.MakeRequest(t, req, http.StatusOK) + DecodeJSON(t, resp, &apiIssues) + assert.Len(t, apiIssues, 6) + + query = url.Values{"owner": {"user3"}} // organization + link.RawQuery = query.Encode() + req = NewRequest(t, "GET", link.String()) + resp = session.MakeRequest(t, req, http.StatusOK) + DecodeJSON(t, resp, &apiIssues) + assert.Len(t, apiIssues, 3) + + query = url.Values{"owner": {"user3"}, "team": {"team1"}} // organization + team + link.RawQuery = query.Encode() + req = NewRequest(t, "GET", link.String()) + resp = session.MakeRequest(t, req, http.StatusOK) + DecodeJSON(t, resp, &apiIssues) + assert.Len(t, apiIssues, 2) } func TestAPISearchIssuesWithLabels(t *testing.T) { |