You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
867 B

  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}, 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"], 1)
  26. }