diff options
author | Brad Albright <32200834+bhalbright@users.noreply.github.com> | 2019-12-15 08:20:08 -0600 |
---|---|---|
committer | zeripath <art27@cantab.net> | 2019-12-15 14:20:08 +0000 |
commit | f6b29012e09d5f7770a0b1ea8659da5172e155b3 (patch) | |
tree | cf78ded22aee572c91e93e2a2a3db8a7f9fd903c /routers/user/home_test.go | |
parent | 7cc16740a56072465b3938cbb9cd326d40bd7ba9 (diff) | |
download | gitea-f6b29012e09d5f7770a0b1ea8659da5172e155b3.tar.gz gitea-f6b29012e09d5f7770a0b1ea8659da5172e155b3.zip |
Add /milestones endpoint (#8733)
Create a /milestones endpoint which basically serves as a dashboard view for milestones, very similar to the /issues or /pulls page.
Closes #8232
Diffstat (limited to 'routers/user/home_test.go')
-rw-r--r-- | routers/user/home_test.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/routers/user/home_test.go b/routers/user/home_test.go index 9d4136ac8c..e5bbd0e98e 100644 --- a/routers/user/home_test.go +++ b/routers/user/home_test.go @@ -31,3 +31,42 @@ func TestIssues(t *testing.T) { assert.Len(t, ctx.Data["Issues"], 1) assert.Len(t, ctx.Data["Repos"], 1) } + +func TestMilestones(t *testing.T) { + setting.UI.IssuePagingNum = 1 + assert.NoError(t, models.LoadFixtures()) + + ctx := test.MockContext(t, "milestones") + test.LoadUser(t, ctx, 2) + ctx.SetParams("sort", "issues") + ctx.Req.Form.Set("state", "closed") + ctx.Req.Form.Set("sort", "furthestduedate") + Milestones(ctx) + assert.EqualValues(t, http.StatusOK, ctx.Resp.Status()) + assert.EqualValues(t, map[int64]int64{1: 1}, ctx.Data["Counts"]) + assert.EqualValues(t, true, ctx.Data["IsShowClosed"]) + assert.EqualValues(t, "furthestduedate", ctx.Data["SortType"]) + assert.EqualValues(t, 1, ctx.Data["Total"]) + assert.Len(t, ctx.Data["Milestones"], 1) + assert.Len(t, ctx.Data["Repos"], 1) +} + +func TestMilestonesForSpecificRepo(t *testing.T) { + setting.UI.IssuePagingNum = 1 + assert.NoError(t, models.LoadFixtures()) + + ctx := test.MockContext(t, "milestones") + test.LoadUser(t, ctx, 2) + ctx.SetParams("sort", "issues") + ctx.SetParams("repo", "1") + ctx.Req.Form.Set("state", "closed") + ctx.Req.Form.Set("sort", "furthestduedate") + Milestones(ctx) + assert.EqualValues(t, http.StatusOK, ctx.Resp.Status()) + assert.EqualValues(t, map[int64]int64{1: 1}, ctx.Data["Counts"]) + assert.EqualValues(t, true, ctx.Data["IsShowClosed"]) + assert.EqualValues(t, "furthestduedate", ctx.Data["SortType"]) + assert.EqualValues(t, 1, ctx.Data["Total"]) + assert.Len(t, ctx.Data["Milestones"], 1) + assert.Len(t, ctx.Data["Repos"], 1) +} |