Fork to maintain patches against the official gitea for https://code.ceondo.com https://github.com/go-gitea/gitea

home_test.go 873B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package user
  5. import (
  6. "net/http"
  7. "testing"
  8. "code.gitea.io/gitea/models"
  9. "code.gitea.io/gitea/modules/test"
  10. "code.gitea.io/gitea/modules/setting"
  11. "github.com/stretchr/testify/assert"
  12. )
  13. func TestIssues(t *testing.T) {
  14. setting.UI.IssuePagingNum = 1
  15. assert.NoError(t, models.LoadFixtures())
  16. ctx := test.MockContext(t, "issues")
  17. test.LoadUser(t, ctx, 2)
  18. ctx.SetParams(":type", "issues")
  19. ctx.Req.Form.Set("state", "closed")
  20. Issues(ctx)
  21. assert.EqualValues(t, http.StatusOK, ctx.Resp.Status())
  22. assert.EqualValues(t, map[int64]int64{1: 1, 2: 1}, ctx.Data["Counts"])
  23. assert.EqualValues(t, true, ctx.Data["IsShowClosed"])
  24. assert.Len(t, ctx.Data["Issues"], 1)
  25. assert.Len(t, ctx.Data["Repos"], 2)
  26. }