1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-24 19:28:38 +00:00

Enable testifylint rules (#34075)

enable testifylint rules disabled in:
https://github.com/go-gitea/gitea/pull/34054
This commit is contained in:
TheFox0x7
2025-03-31 07:53:48 +02:00
committed by GitHub
parent 0fd5392087
commit 0fde8ecd55
262 changed files with 1315 additions and 1365 deletions

View File

@@ -25,8 +25,8 @@ func TestRepository_GetCollaborators(t *testing.T) {
assert.NoError(t, err)
assert.Len(t, collaborators, int(expectedLen))
for _, collaborator := range collaborators {
assert.EqualValues(t, collaborator.User.ID, collaborator.Collaboration.UserID)
assert.EqualValues(t, repoID, collaborator.Collaboration.RepoID)
assert.Equal(t, collaborator.User.ID, collaborator.Collaboration.UserID)
assert.Equal(t, repoID, collaborator.Collaboration.RepoID)
}
}
test(1)
@@ -51,7 +51,7 @@ func TestRepository_GetCollaborators(t *testing.T) {
assert.NoError(t, err)
assert.Len(t, collaborators2, 1)
assert.NotEqualValues(t, collaborators1[0].ID, collaborators2[0].ID)
assert.NotEqual(t, collaborators1[0].ID, collaborators2[0].ID)
}
func TestRepository_IsCollaborator(t *testing.T) {
@@ -76,10 +76,10 @@ func TestRepository_ChangeCollaborationAccessMode(t *testing.T) {
assert.NoError(t, repo_model.ChangeCollaborationAccessMode(db.DefaultContext, repo, 4, perm.AccessModeAdmin))
collaboration := unittest.AssertExistsAndLoadBean(t, &repo_model.Collaboration{RepoID: repo.ID, UserID: 4})
assert.EqualValues(t, perm.AccessModeAdmin, collaboration.Mode)
assert.Equal(t, perm.AccessModeAdmin, collaboration.Mode)
access := unittest.AssertExistsAndLoadBean(t, &access_model.Access{UserID: 4, RepoID: repo.ID})
assert.EqualValues(t, perm.AccessModeAdmin, access.Mode)
assert.Equal(t, perm.AccessModeAdmin, access.Mode)
assert.NoError(t, repo_model.ChangeCollaborationAccessMode(db.DefaultContext, repo, 4, perm.AccessModeAdmin))

View File

@@ -12,19 +12,19 @@ import (
func TestActionsConfig(t *testing.T) {
cfg := &ActionsConfig{}
cfg.DisableWorkflow("test1.yaml")
assert.EqualValues(t, []string{"test1.yaml"}, cfg.DisabledWorkflows)
assert.Equal(t, []string{"test1.yaml"}, cfg.DisabledWorkflows)
cfg.DisableWorkflow("test1.yaml")
assert.EqualValues(t, []string{"test1.yaml"}, cfg.DisabledWorkflows)
assert.Equal(t, []string{"test1.yaml"}, cfg.DisabledWorkflows)
cfg.EnableWorkflow("test1.yaml")
assert.EqualValues(t, []string{}, cfg.DisabledWorkflows)
assert.Equal(t, []string{}, cfg.DisabledWorkflows)
cfg.EnableWorkflow("test1.yaml")
assert.EqualValues(t, []string{}, cfg.DisabledWorkflows)
assert.Equal(t, []string{}, cfg.DisabledWorkflows)
cfg.DisableWorkflow("test1.yaml")
cfg.DisableWorkflow("test2.yaml")
cfg.DisableWorkflow("test3.yaml")
assert.EqualValues(t, "test1.yaml,test2.yaml,test3.yaml", cfg.ToString())
assert.Equal(t, "test1.yaml,test2.yaml,test3.yaml", cfg.ToString())
}

View File

@@ -53,7 +53,7 @@ func TestAddTopic(t *testing.T) {
totalNrOfTopics++
topic, err := repo_model.GetTopicByName(db.DefaultContext, "gitea")
assert.NoError(t, err)
assert.EqualValues(t, 1, topic.RepoCount)
assert.Equal(t, 1, topic.RepoCount)
topics, err = db.Find[repo_model.Topic](db.DefaultContext, &repo_model.FindTopicOptions{})
assert.NoError(t, err)

View File

@@ -36,7 +36,7 @@ func TestGetWatchers(t *testing.T) {
// One watchers are inactive, thus minus 1
assert.Len(t, watches, repo.NumWatches-1)
for _, watch := range watches {
assert.EqualValues(t, repo.ID, watch.RepoID)
assert.Equal(t, repo.ID, watch.RepoID)
}
watches, err = repo_model.GetWatchers(db.DefaultContext, unittest.NonexistentID)