summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/integration/api_admin_test.go2
-rw-r--r--tests/integration/api_comment_attachment_test.go2
-rw-r--r--tests/integration/api_comment_test.go4
-rw-r--r--tests/integration/api_issue_config_test.go2
-rw-r--r--tests/integration/api_pull_review_test.go6
-rw-r--r--tests/integration/api_pull_test.go6
-rw-r--r--tests/integration/api_repo_archive_test.go6
-rw-r--r--tests/integration/api_repo_edit_test.go14
-rw-r--r--tests/integration/api_repo_test.go4
-rw-r--r--tests/integration/auth_ldap_test.go8
-rw-r--r--tests/integration/cors_test.go2
-rw-r--r--tests/integration/empty_repo_test.go4
-rw-r--r--tests/integration/git_test.go8
-rw-r--r--tests/integration/pull_merge_test.go2
-rw-r--r--tests/integration/repo_test.go8
15 files changed, 39 insertions, 39 deletions
diff --git a/tests/integration/api_admin_test.go b/tests/integration/api_admin_test.go
index b608c26f6e..53e4849aa5 100644
--- a/tests/integration/api_admin_test.go
+++ b/tests/integration/api_admin_test.go
@@ -123,7 +123,7 @@ func TestAPIListUsers(t *testing.T) {
}
assert.True(t, found)
numberOfUsers := unittest.GetCount(t, &user_model.User{}, "type = 0")
- assert.Equal(t, numberOfUsers, len(users))
+ assert.Len(t, users, numberOfUsers)
}
func TestAPIListUsersNotLoggedIn(t *testing.T) {
diff --git a/tests/integration/api_comment_attachment_test.go b/tests/integration/api_comment_attachment_test.go
index 1f916ffa15..1d0b902b39 100644
--- a/tests/integration/api_comment_attachment_test.go
+++ b/tests/integration/api_comment_attachment_test.go
@@ -68,7 +68,7 @@ func TestAPIListCommentAttachments(t *testing.T) {
var apiAttachments []*api.Attachment
DecodeJSON(t, resp, &apiAttachments)
expectedCount := unittest.GetCount(t, &repo_model.Attachment{CommentID: comment.ID})
- assert.EqualValues(t, expectedCount, len(apiAttachments))
+ assert.Len(t, apiAttachments, expectedCount)
unittest.AssertExistsAndLoadBean(t, &repo_model.Attachment{ID: apiAttachments[0].ID, CommentID: comment.ID})
}
diff --git a/tests/integration/api_comment_test.go b/tests/integration/api_comment_test.go
index 70affc9899..56de8b5909 100644
--- a/tests/integration/api_comment_test.go
+++ b/tests/integration/api_comment_test.go
@@ -85,7 +85,7 @@ func TestAPIListIssueComments(t *testing.T) {
DecodeJSON(t, resp, &comments)
expectedCount := unittest.GetCount(t, &issues_model.Comment{IssueID: issue.ID},
unittest.Cond("type = ?", issues_model.CommentTypeComment))
- assert.EqualValues(t, expectedCount, len(comments))
+ assert.Len(t, comments, expectedCount)
}
func TestAPICreateComment(t *testing.T) {
@@ -196,5 +196,5 @@ func TestAPIListIssueTimeline(t *testing.T) {
var comments []*api.TimelineComment
DecodeJSON(t, resp, &comments)
expectedCount := unittest.GetCount(t, &issues_model.Comment{IssueID: issue.ID})
- assert.EqualValues(t, expectedCount, len(comments))
+ assert.Len(t, comments, expectedCount)
}
diff --git a/tests/integration/api_issue_config_test.go b/tests/integration/api_issue_config_test.go
index b9b3765c4e..f3dc663f3b 100644
--- a/tests/integration/api_issue_config_test.go
+++ b/tests/integration/api_issue_config_test.go
@@ -48,5 +48,5 @@ func TestAPIReposValidateDefaultIssueConfig(t *testing.T) {
DecodeJSON(t, resp, &issueConfigValidation)
assert.True(t, issueConfigValidation.Valid)
- assert.Equal(t, issueConfigValidation.Message, "")
+ assert.Empty(t, issueConfigValidation.Message)
}
diff --git a/tests/integration/api_pull_review_test.go b/tests/integration/api_pull_review_test.go
index cfb56724a6..e0abf34f5e 100644
--- a/tests/integration/api_pull_review_test.go
+++ b/tests/integration/api_pull_review_test.go
@@ -170,8 +170,8 @@ func TestAPIPullReview(t *testing.T) {
DecodeJSON(t, resp, &commentReview)
assert.EqualValues(t, "COMMENT", commentReview.State)
assert.EqualValues(t, 2, commentReview.CodeCommentsCount)
- assert.EqualValues(t, "", commentReview.Body)
- assert.EqualValues(t, false, commentReview.Dismissed)
+ assert.Empty(t, commentReview.Body)
+ assert.False(t, commentReview.Dismissed)
// test CreatePullReview Comment with body but without comments
commentBody := "This is a body of the comment."
@@ -186,7 +186,7 @@ func TestAPIPullReview(t *testing.T) {
assert.EqualValues(t, "COMMENT", commentReview.State)
assert.EqualValues(t, 0, commentReview.CodeCommentsCount)
assert.EqualValues(t, commentBody, commentReview.Body)
- assert.EqualValues(t, false, commentReview.Dismissed)
+ assert.False(t, commentReview.Dismissed)
// test CreatePullReview Comment without body and no comments
req = NewRequestWithJSON(t, http.MethodPost, fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/reviews?token=%s", repo.OwnerName, repo.Name, pullIssue.Index, token), &api.CreatePullReviewOptions{
diff --git a/tests/integration/api_pull_test.go b/tests/integration/api_pull_test.go
index 4b25f97ddd..cf675f9740 100644
--- a/tests/integration/api_pull_test.go
+++ b/tests/integration/api_pull_test.go
@@ -49,12 +49,12 @@ func TestAPIViewPulls(t *testing.T) {
t.Run(fmt.Sprintf("APIGetPullFiles_%d", pull.ID),
doAPIGetPullFiles(ctx, pull, func(t *testing.T, files []*api.ChangedFile) {
if assert.Len(t, files, 1) {
- assert.EqualValues(t, "File-WoW", files[0].Filename)
- assert.EqualValues(t, "", files[0].PreviousFilename)
+ assert.Equal(t, "File-WoW", files[0].Filename)
+ assert.Empty(t, files[0].PreviousFilename)
assert.EqualValues(t, 1, files[0].Additions)
assert.EqualValues(t, 1, files[0].Changes)
assert.EqualValues(t, 0, files[0].Deletions)
- assert.EqualValues(t, "added", files[0].Status)
+ assert.Equal(t, "added", files[0].Status)
}
}))
}
diff --git a/tests/integration/api_repo_archive_test.go b/tests/integration/api_repo_archive_test.go
index fbcc12ccb6..699d7a436c 100644
--- a/tests/integration/api_repo_archive_test.go
+++ b/tests/integration/api_repo_archive_test.go
@@ -32,21 +32,21 @@ func TestAPIDownloadArchive(t *testing.T) {
resp := MakeRequest(t, NewRequest(t, "GET", link.String()), http.StatusOK)
bs, err := io.ReadAll(resp.Body)
assert.NoError(t, err)
- assert.EqualValues(t, 320, len(bs))
+ assert.Len(t, bs, 320)
link, _ = url.Parse(fmt.Sprintf("/api/v1/repos/%s/%s/archive/master.tar.gz", user2.Name, repo.Name))
link.RawQuery = url.Values{"token": {token}}.Encode()
resp = MakeRequest(t, NewRequest(t, "GET", link.String()), http.StatusOK)
bs, err = io.ReadAll(resp.Body)
assert.NoError(t, err)
- assert.EqualValues(t, 266, len(bs))
+ assert.Len(t, bs, 266)
link, _ = url.Parse(fmt.Sprintf("/api/v1/repos/%s/%s/archive/master.bundle", user2.Name, repo.Name))
link.RawQuery = url.Values{"token": {token}}.Encode()
resp = MakeRequest(t, NewRequest(t, "GET", link.String()), http.StatusOK)
bs, err = io.ReadAll(resp.Body)
assert.NoError(t, err)
- assert.EqualValues(t, 382, len(bs))
+ assert.Len(t, bs, 382)
link, _ = url.Parse(fmt.Sprintf("/api/v1/repos/%s/%s/archive/master", user2.Name, repo.Name))
link.RawQuery = url.Values{"token": {token}}.Encode()
diff --git a/tests/integration/api_repo_edit_test.go b/tests/integration/api_repo_edit_test.go
index 9594b86d7e..30dc73ef1b 100644
--- a/tests/integration/api_repo_edit_test.go
+++ b/tests/integration/api_repo_edit_test.go
@@ -194,10 +194,10 @@ func TestAPIRepoEdit(t *testing.T) {
// check repo1 was written to database
repo1edited = unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
repo1editedOption = getRepoEditOptionFromRepo(repo1edited)
- assert.Equal(t, *repo1editedOption.HasIssues, true)
+ assert.True(t, *repo1editedOption.HasIssues)
assert.Nil(t, repo1editedOption.ExternalTracker)
assert.Equal(t, *repo1editedOption.InternalTracker, *repoEditOption.InternalTracker)
- assert.Equal(t, *repo1editedOption.HasWiki, true)
+ assert.True(t, *repo1editedOption.HasWiki)
assert.Nil(t, repo1editedOption.ExternalWiki)
// Test editing repo1 to use external issue and wiki
@@ -216,9 +216,9 @@ func TestAPIRepoEdit(t *testing.T) {
// check repo1 was written to database
repo1edited = unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
repo1editedOption = getRepoEditOptionFromRepo(repo1edited)
- assert.Equal(t, *repo1editedOption.HasIssues, true)
+ assert.True(t, *repo1editedOption.HasIssues)
assert.Equal(t, *repo1editedOption.ExternalTracker, *repoEditOption.ExternalTracker)
- assert.Equal(t, *repo1editedOption.HasWiki, true)
+ assert.True(t, *repo1editedOption.HasWiki)
assert.Equal(t, *repo1editedOption.ExternalWiki, *repoEditOption.ExternalWiki)
repoEditOption.ExternalTracker.ExternalTrackerStyle = "regexp"
@@ -229,7 +229,7 @@ func TestAPIRepoEdit(t *testing.T) {
assert.NotNil(t, repo)
repo1edited = unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
repo1editedOption = getRepoEditOptionFromRepo(repo1edited)
- assert.Equal(t, *repo1editedOption.HasIssues, true)
+ assert.True(t, *repo1editedOption.HasIssues)
assert.Equal(t, *repo1editedOption.ExternalTracker, *repoEditOption.ExternalTracker)
// Do some tests with invalid URL for external tracker and wiki
@@ -259,9 +259,9 @@ func TestAPIRepoEdit(t *testing.T) {
repo1edited = unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
repo1editedOption = getRepoEditOptionFromRepo(repo1edited)
assert.Equal(t, *repo1editedOption.Description, *repoEditOption.Description)
- assert.Equal(t, *repo1editedOption.HasIssues, true)
+ assert.True(t, *repo1editedOption.HasIssues)
assert.NotNil(t, *repo1editedOption.ExternalTracker)
- assert.Equal(t, *repo1editedOption.HasWiki, true)
+ assert.True(t, *repo1editedOption.HasWiki)
assert.NotNil(t, *repo1editedOption.ExternalWiki)
// reset repo in db
diff --git a/tests/integration/api_repo_test.go b/tests/integration/api_repo_test.go
index ecaa9fe986..aa4e674206 100644
--- a/tests/integration/api_repo_test.go
+++ b/tests/integration/api_repo_test.go
@@ -412,7 +412,7 @@ func TestAPIMirrorSyncNonMirrorRepo(t *testing.T) {
req := NewRequest(t, "GET", "/api/v1/repos/user2/repo1")
resp := MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, resp, &repo)
- assert.EqualValues(t, false, repo.Mirror)
+ assert.False(t, repo.Mirror)
req = NewRequestf(t, "POST", "/api/v1/repos/user2/repo1/mirror-sync?token=%s", token)
resp = MakeRequest(t, req, http.StatusBadRequest)
@@ -469,7 +469,7 @@ func testAPIRepoCreateConflict(t *testing.T, u *url.URL) {
resp := httpContext.Session.MakeRequest(t, req, http.StatusConflict)
respJSON := map[string]string{}
DecodeJSON(t, resp, &respJSON)
- assert.Equal(t, respJSON["message"], "The repository with the same name already exists.")
+ assert.Equal(t, "The repository with the same name already exists.", respJSON["message"])
})
}
diff --git a/tests/integration/auth_ldap_test.go b/tests/integration/auth_ldap_test.go
index 883c9d80a3..81f8d9ddd7 100644
--- a/tests/integration/auth_ldap_test.go
+++ b/tests/integration/auth_ldap_test.go
@@ -203,7 +203,7 @@ func TestLDAPAuthChange(t *testing.T) {
host, _ := doc.Find(`input[name="host"]`).Attr("value")
assert.Equal(t, host, getLDAPServerHost())
binddn, _ := doc.Find(`input[name="bind_dn"]`).Attr("value")
- assert.Equal(t, binddn, "uid=gitea,ou=service,dc=planetexpress,dc=com")
+ assert.Equal(t, "uid=gitea,ou=service,dc=planetexpress,dc=com", binddn)
req = NewRequestWithValues(t, "POST", href, buildAuthSourceLDAPPayload(csrf, "", "", "", "off"))
session.MakeRequest(t, req, http.StatusSeeOther)
@@ -214,7 +214,7 @@ func TestLDAPAuthChange(t *testing.T) {
host, _ = doc.Find(`input[name="host"]`).Attr("value")
assert.Equal(t, host, getLDAPServerHost())
binddn, _ = doc.Find(`input[name="bind_dn"]`).Attr("value")
- assert.Equal(t, binddn, "uid=gitea,ou=service,dc=planetexpress,dc=com")
+ assert.Equal(t, "uid=gitea,ou=service,dc=planetexpress,dc=com", binddn)
}
func TestLDAPUserSync(t *testing.T) {
@@ -397,8 +397,8 @@ func TestLDAPGroupTeamSyncAddMember(t *testing.T) {
assert.NoError(t, err)
if user.Name == "fry" || user.Name == "leela" || user.Name == "bender" {
// assert members of LDAP group "cn=ship_crew" are added to mapped teams
- assert.Equal(t, len(usersOrgs), 1, "User [%s] should be member of one organization", user.Name)
- assert.Equal(t, usersOrgs[0].Name, "org26", "Membership should be added to the right organization")
+ assert.Len(t, usersOrgs, 1, "User [%s] should be member of one organization", user.Name)
+ assert.Equal(t, "org26", usersOrgs[0].Name, "Membership should be added to the right organization")
isMember, err := organization.IsTeamMember(db.DefaultContext, usersOrgs[0].ID, team.ID, user.ID)
assert.NoError(t, err)
assert.True(t, isMember, "Membership should be added to the right team")
diff --git a/tests/integration/cors_test.go b/tests/integration/cors_test.go
index cc2d85b41e..e4151d1c32 100644
--- a/tests/integration/cors_test.go
+++ b/tests/integration/cors_test.go
@@ -19,5 +19,5 @@ func TestCORSNotSet(t *testing.T) {
resp := session.MakeRequest(t, req, http.StatusOK)
assert.Equal(t, resp.Code, http.StatusOK)
corsHeader := resp.Header().Get("Access-Control-Allow-Origin")
- assert.Equal(t, corsHeader, "", "Access-Control-Allow-Origin: generated header should match") // header not set
+ assert.Empty(t, corsHeader, "Access-Control-Allow-Origin: generated header should match") // header not set
}
diff --git a/tests/integration/empty_repo_test.go b/tests/integration/empty_repo_test.go
index 80697c7329..e6e5f7b18c 100644
--- a/tests/integration/empty_repo_test.go
+++ b/tests/integration/empty_repo_test.go
@@ -49,7 +49,7 @@ func TestEmptyRepoAddFile(t *testing.T) {
req := NewRequest(t, "GET", "/user30/empty/_new/"+setting.Repository.DefaultBranch)
resp := session.MakeRequest(t, req, http.StatusOK)
doc := NewHTMLParser(t, resp.Body).Find(`input[name="commit_choice"]`)
- assert.Equal(t, "", doc.AttrOr("checked", "_no_"))
+ assert.Empty(t, doc.AttrOr("checked", "_no_"))
req = NewRequestWithValues(t, "POST", "/user30/empty/_new/"+setting.Repository.DefaultBranch, map[string]string{
"_csrf": GetCSRF(t, session, "/user/settings"),
"commit_choice": "direct",
@@ -76,7 +76,7 @@ func TestEmptyRepoUploadFile(t *testing.T) {
req := NewRequest(t, "GET", "/user30/empty/_new/"+setting.Repository.DefaultBranch)
resp := session.MakeRequest(t, req, http.StatusOK)
doc := NewHTMLParser(t, resp.Body).Find(`input[name="commit_choice"]`)
- assert.Equal(t, "", doc.AttrOr("checked", "_no_"))
+ assert.Empty(t, doc.AttrOr("checked", "_no_"))
body := &bytes.Buffer{}
mpForm := multipart.NewWriter(body)
diff --git a/tests/integration/git_test.go b/tests/integration/git_test.go
index 95323b91c6..8d5c0fc390 100644
--- a/tests/integration/git_test.go
+++ b/tests/integration/git_test.go
@@ -763,7 +763,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
return
}
assert.Equal(t, "user2/"+headBranch, pr1.HeadBranch)
- assert.Equal(t, false, prMsg.HasMerged)
+ assert.False(t, prMsg.HasMerged)
assert.Contains(t, "Testing commit 1", prMsg.Body)
assert.Equal(t, commit, prMsg.Head.Sha)
@@ -785,7 +785,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
return
}
assert.Equal(t, "user2/test/"+headBranch, pr2.HeadBranch)
- assert.Equal(t, false, prMsg.HasMerged)
+ assert.False(t, prMsg.HasMerged)
})
if pr1 == nil || pr2 == nil {
@@ -829,7 +829,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
if !assert.NoError(t, err) {
return
}
- assert.Equal(t, false, prMsg.HasMerged)
+ assert.False(t, prMsg.HasMerged)
assert.Equal(t, commit, prMsg.Head.Sha)
_, _, err = git.NewCommand(git.DefaultContext, "push", "origin").AddDynamicArguments("HEAD:refs/for/master/test/" + headBranch).RunStdString(&git.RunOpts{Dir: dstPath})
@@ -841,7 +841,7 @@ func doCreateAgitFlowPull(dstPath string, ctx *APITestContext, baseBranch, headB
if !assert.NoError(t, err) {
return
}
- assert.Equal(t, false, prMsg.HasMerged)
+ assert.False(t, prMsg.HasMerged)
assert.Equal(t, commit, prMsg.Head.Sha)
})
t.Run("Merge", doAPIMergePullRequest(*ctx, ctx.Username, ctx.Reponame, pr1.Index))
diff --git a/tests/integration/pull_merge_test.go b/tests/integration/pull_merge_test.go
index ee185f2238..9271f25e5f 100644
--- a/tests/integration/pull_merge_test.go
+++ b/tests/integration/pull_merge_test.go
@@ -414,7 +414,7 @@ func TestConflictChecking(t *testing.T) {
assert.NoError(t, err)
// Ensure conflictedFiles is populated.
- assert.Equal(t, 1, len(conflictingPR.ConflictedFiles))
+ assert.Len(t, conflictingPR.ConflictedFiles, 1)
// Check if status is correct.
assert.Equal(t, issues_model.PullRequestStatusConflict, conflictingPR.Status)
// Ensure that mergeable returns false
diff --git a/tests/integration/repo_test.go b/tests/integration/repo_test.go
index f03a3b37fd..f2bc04864a 100644
--- a/tests/integration/repo_test.go
+++ b/tests/integration/repo_test.go
@@ -376,7 +376,7 @@ func TestMarkDownReadmeImage(t *testing.T) {
htmlDoc := NewHTMLParser(t, resp.Body)
src, exists := htmlDoc.doc.Find(`.markdown img`).Attr("src")
assert.True(t, exists, "Image not found in README")
- assert.Equal(t, src, "/user2/repo1/media/branch/home-md-img-check/test-fake-img.jpg")
+ assert.Equal(t, "/user2/repo1/media/branch/home-md-img-check/test-fake-img.jpg", src)
req = NewRequest(t, "GET", "/user2/repo1/src/branch/home-md-img-check/README.md")
resp = session.MakeRequest(t, req, http.StatusOK)
@@ -384,7 +384,7 @@ func TestMarkDownReadmeImage(t *testing.T) {
htmlDoc = NewHTMLParser(t, resp.Body)
src, exists = htmlDoc.doc.Find(`.markdown img`).Attr("src")
assert.True(t, exists, "Image not found in markdown file")
- assert.Equal(t, src, "/user2/repo1/media/branch/home-md-img-check/test-fake-img.jpg")
+ assert.Equal(t, "/user2/repo1/media/branch/home-md-img-check/test-fake-img.jpg", src)
}
func TestMarkDownReadmeImageSubfolder(t *testing.T) {
@@ -399,7 +399,7 @@ func TestMarkDownReadmeImageSubfolder(t *testing.T) {
htmlDoc := NewHTMLParser(t, resp.Body)
src, exists := htmlDoc.doc.Find(`.markdown img`).Attr("src")
assert.True(t, exists, "Image not found in README")
- assert.Equal(t, src, "/user2/repo1/media/branch/sub-home-md-img-check/docs/test-fake-img.jpg")
+ assert.Equal(t, "/user2/repo1/media/branch/sub-home-md-img-check/docs/test-fake-img.jpg", src)
req = NewRequest(t, "GET", "/user2/repo1/src/branch/sub-home-md-img-check/docs/README.md")
resp = session.MakeRequest(t, req, http.StatusOK)
@@ -407,5 +407,5 @@ func TestMarkDownReadmeImageSubfolder(t *testing.T) {
htmlDoc = NewHTMLParser(t, resp.Body)
src, exists = htmlDoc.doc.Find(`.markdown img`).Attr("src")
assert.True(t, exists, "Image not found in markdown file")
- assert.Equal(t, src, "/user2/repo1/media/branch/sub-home-md-img-check/docs/test-fake-img.jpg")
+ assert.Equal(t, "/user2/repo1/media/branch/sub-home-md-img-check/docs/test-fake-img.jpg", src)
}