diff options
author | 6543 <6543@obermui.de> | 2020-01-08 22:14:00 +0100 |
---|---|---|
committer | techknowlogick <techknowlogick@gitea.io> | 2020-01-08 16:14:00 -0500 |
commit | 14a96874442a13bb212affb13a585f0536d89c2a (patch) | |
tree | f5406f59da2da0c70ca0d4efa3af3343b02debbb /integrations | |
parent | f8dcc5f9f8e389218f1908ad9d5fe2044102abf1 (diff) | |
download | gitea-14a96874442a13bb212affb13a585f0536d89c2a.tar.gz gitea-14a96874442a13bb212affb13a585f0536d89c2a.zip |
times Add filters (#9373)
(extend #9200)
* add query param for GET functions (created Bevore & after)
* add test
* generalize func GetQueryBeforeSince
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'integrations')
-rw-r--r-- | integrations/api_issue_tracked_time_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/integrations/api_issue_tracked_time_test.go b/integrations/api_issue_tracked_time_test.go index ed6c036db6..97d401ff9d 100644 --- a/integrations/api_issue_tracked_time_test.go +++ b/integrations/api_issue_tracked_time_test.go @@ -44,6 +44,18 @@ func TestAPIGetTrackedTimes(t *testing.T) { assert.NoError(t, err) assert.Equal(t, user.Name, apiTimes[i].UserName) } + + // test filter + since := "2000-01-01T00%3A00%3A02%2B00%3A00" //946684802 + before := "2000-01-01T00%3A00%3A12%2B00%3A00" //946684812 + + req = NewRequestf(t, "GET", "/api/v1/repos/%s/%s/issues/%d/times?since=%s&before=%s&token=%s", user2.Name, issue2.Repo.Name, issue2.Index, since, before, token) + resp = session.MakeRequest(t, req, http.StatusOK) + var filterAPITimes api.TrackedTimeList + DecodeJSON(t, resp, &filterAPITimes) + assert.Len(t, filterAPITimes, 2) + assert.Equal(t, int64(3), filterAPITimes[0].ID) + assert.Equal(t, int64(6), filterAPITimes[1].ID) } func TestAPIDeleteTrackedTime(t *testing.T) { |