mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-21 00:20:50 +00:00
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
This commit is contained in:
parent
3a6edd3685
commit
a4962a9440
5 changed files with 87 additions and 3 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue