Add testifylint to lint checks (#4535)

go-require lint is ignored for now

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/4535
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
Co-committed-by: TheFox0x7 <thefox0x7@gmail.com>
This commit is contained in:
TheFox0x7 2024-07-30 19:41:10 +00:00 committed by Earl Warren
parent 94933470cd
commit 4de909747b
504 changed files with 5028 additions and 4680 deletions

View file

@ -20,6 +20,7 @@ import (
"code.gitea.io/gitea/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestRepoActivity(t *testing.T) {
@ -83,13 +84,13 @@ func TestRepoActivityAllUnitsDisabled(t *testing.T) {
Name: "empty-repo",
AutoInit: false,
})
assert.NoError(t, err)
require.NoError(t, err)
assert.NotEmpty(t, repo)
enabledUnits := make([]repo_model.RepoUnit, 0)
disabledUnits := []unit_model.Type{unit_model.TypeCode, unit_model.TypeIssues, unit_model.TypePullRequests, unit_model.TypeReleases}
err = repo_service.UpdateRepositoryUnits(db.DefaultContext, repo, enabledUnits, disabledUnits)
assert.NoError(t, err)
require.NoError(t, err)
req := NewRequest(t, "GET", fmt.Sprintf("%s/activity", repo.Link()))
session.MakeRequest(t, req, http.StatusNotFound)
@ -113,14 +114,14 @@ func TestRepoActivityOnlyCodeUnitWithEmptyRepo(t *testing.T) {
Name: "empty-repo",
AutoInit: false,
})
assert.NoError(t, err)
require.NoError(t, err)
assert.NotEmpty(t, repo)
enabledUnits := make([]repo_model.RepoUnit, 1)
enabledUnits[0] = repo_model.RepoUnit{RepoID: repo.ID, Type: unit_model.TypeCode}
disabledUnits := []unit_model.Type{unit_model.TypeIssues, unit_model.TypePullRequests, unit_model.TypeReleases}
err = repo_service.UpdateRepositoryUnits(db.DefaultContext, repo, enabledUnits, disabledUnits)
assert.NoError(t, err)
require.NoError(t, err)
req := NewRequest(t, "GET", fmt.Sprintf("%s/activity", repo.Link()))
session.MakeRequest(t, req, http.StatusOK)
@ -169,14 +170,14 @@ func TestRepoActivityOnlyIssuesUnit(t *testing.T) {
Name: "empty-repo",
AutoInit: false,
})
assert.NoError(t, err)
require.NoError(t, err)
assert.NotEmpty(t, repo)
enabledUnits := make([]repo_model.RepoUnit, 1)
enabledUnits[0] = repo_model.RepoUnit{RepoID: repo.ID, Type: unit_model.TypeIssues}
disabledUnits := []unit_model.Type{unit_model.TypeCode, unit_model.TypePullRequests, unit_model.TypeReleases}
err = repo_service.UpdateRepositoryUnits(db.DefaultContext, repo, enabledUnits, disabledUnits)
assert.NoError(t, err)
require.NoError(t, err)
req := NewRequest(t, "GET", fmt.Sprintf("%s/activity", repo.Link()))
session.MakeRequest(t, req, http.StatusOK)