aboutsummaryrefslogtreecommitdiffstats
path: root/services/issue
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-04-22 23:56:27 +0200
committerGitHub <noreply@github.com>2023-04-22 17:56:27 -0400
commitf1173d6879cb26af21483037fae72542f3088408 (patch)
treea1ed73fb2a42c351005974698076f5ee82489d5d /services/issue
parentac384c4e1d207a989d0f646ebc14fd0c26427d4c (diff)
downloadgitea-f1173d6879cb26af21483037fae72542f3088408.tar.gz
gitea-f1173d6879cb26af21483037fae72542f3088408.zip
Use more specific test methods (#24265)
Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'services/issue')
-rw-r--r--services/issue/assignee_test.go6
-rw-r--r--services/issue/issue_test.go6
2 files changed, 6 insertions, 6 deletions
diff --git a/services/issue/assignee_test.go b/services/issue/assignee_test.go
index 43b24e1d1f..f47ef45ba0 100644
--- a/services/issue/assignee_test.go
+++ b/services/issue/assignee_test.go
@@ -20,7 +20,7 @@ func TestDeleteNotPassedAssignee(t *testing.T) {
// Fake issue with assignees
issue, err := issues_model.GetIssueWithAttrsByID(1)
assert.NoError(t, err)
- assert.EqualValues(t, 1, len(issue.Assignees))
+ assert.Len(t, issue.Assignees, 1)
user1, err := user_model.GetUserByID(db.DefaultContext, 1) // This user is already assigned (see the definition in fixtures), so running UpdateAssignee should unassign him
assert.NoError(t, err)
@@ -33,10 +33,10 @@ func TestDeleteNotPassedAssignee(t *testing.T) {
// Clean everyone
err = DeleteNotPassedAssignee(db.DefaultContext, issue, user1, []*user_model.User{})
assert.NoError(t, err)
- assert.EqualValues(t, 0, len(issue.Assignees))
+ assert.Empty(t, issue.Assignees)
// Check they're gone
assert.NoError(t, issue.LoadAssignees(db.DefaultContext))
- assert.EqualValues(t, 0, len(issue.Assignees))
+ assert.Empty(t, issue.Assignees)
assert.Empty(t, issue.Assignee)
}
diff --git a/services/issue/issue_test.go b/services/issue/issue_test.go
index da0e97c23c..1f6a77096e 100644
--- a/services/issue/issue_test.go
+++ b/services/issue/issue_test.go
@@ -37,7 +37,7 @@ func TestIssue_DeleteIssue(t *testing.T) {
issueIDs, err := issues_model.GetIssueIDsByRepoID(db.DefaultContext, 1)
assert.NoError(t, err)
- assert.EqualValues(t, 5, len(issueIDs))
+ assert.Len(t, issueIDs, 5)
issue := &issues_model.Issue{
RepoID: 1,
@@ -48,7 +48,7 @@ func TestIssue_DeleteIssue(t *testing.T) {
assert.NoError(t, err)
issueIDs, err = issues_model.GetIssueIDsByRepoID(db.DefaultContext, 1)
assert.NoError(t, err)
- assert.EqualValues(t, 4, len(issueIDs))
+ assert.Len(t, issueIDs, 4)
// check attachment removal
attachments, err := repo_model.GetAttachmentsByIssueID(db.DefaultContext, 4)
@@ -57,7 +57,7 @@ func TestIssue_DeleteIssue(t *testing.T) {
assert.NoError(t, err)
err = deleteIssue(db.DefaultContext, issue)
assert.NoError(t, err)
- assert.EqualValues(t, 2, len(attachments))
+ assert.Len(t, attachments, 2)
for i := range attachments {
attachment, err := repo_model.GetAttachmentByUUID(db.DefaultContext, attachments[i].UUID)
assert.Error(t, err)