2017-08-03 10:39:16 +05:30
|
|
|
// Copyright 2017 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package user
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"code.gitea.io/gitea/models"
|
2019-08-23 22:10:30 +05:30
|
|
|
"code.gitea.io/gitea/modules/setting"
|
2017-08-03 10:39:16 +05:30
|
|
|
"code.gitea.io/gitea/modules/test"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestIssues(t *testing.T) {
|
|
|
|
setting.UI.IssuePagingNum = 1
|
|
|
|
assert.NoError(t, models.LoadFixtures())
|
|
|
|
|
2017-11-30 21:22:15 +05:30
|
|
|
ctx := test.MockContext(t, "issues")
|
|
|
|
test.LoadUser(t, ctx, 2)
|
2017-08-03 10:39:16 +05:30
|
|
|
ctx.SetParams(":type", "issues")
|
|
|
|
ctx.Req.Form.Set("state", "closed")
|
|
|
|
Issues(ctx)
|
|
|
|
assert.EqualValues(t, http.StatusOK, ctx.Resp.Status())
|
|
|
|
|
2018-06-21 21:30:13 +05:30
|
|
|
assert.EqualValues(t, map[int64]int64{1: 1}, ctx.Data["Counts"])
|
2017-08-03 10:39:16 +05:30
|
|
|
assert.EqualValues(t, true, ctx.Data["IsShowClosed"])
|
|
|
|
assert.Len(t, ctx.Data["Issues"], 1)
|
2018-06-21 21:30:13 +05:30
|
|
|
assert.Len(t, ctx.Data["Repos"], 1)
|
2017-08-03 10:39:16 +05:30
|
|
|
}
|