本站源代码
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

34 lines
867B

  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/setting"
  10. "code.gitea.io/gitea/modules/test"
  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. }
上海开阖软件有限公司 沪ICP备12045867号-1