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.

home_test.go 873B

123456789101112131415161718192021222324252627282930313233
  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. }