Skip to content

Commit ac8f7cc

Browse files
committed
fix type errors in asserts
1 parent f1d3eb1 commit ac8f7cc

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

models/user/email_address_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func TestListEmails(t *testing.T) {
9797
}
9898
emails, count, err := user_model.SearchEmails(db.DefaultContext, opts)
9999
assert.NoError(t, err)
100-
assert.Greater(t, count, 5)
100+
assert.Greater(t, count, int64(5))
101101

102102
contains := func(match func(s *user_model.SearchEmailResult) bool) bool {
103103
for _, v := range emails {

modules/auth/pam/pam_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ func TestPamAuth(t *testing.T) {
1515
result, err := Auth("gitea", "user1", "false-pwd")
1616
assert.Error(t, err)
1717
assert.EqualError(t, err, "Authentication failure")
18-
assert.Len(t, result, 0)
18+
assert.Len(t, result)
1919
}

modules/util/util_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ func Test_NormalizeEOL(t *testing.T) {
122122

123123
func Test_RandomInt(t *testing.T) {
124124
randInt, err := CryptoRandomInt(255)
125-
assert.GreaterOrEqual(t, randInt, 0)
126-
assert.LessOrEqual(t, randInt, 255)
125+
assert.GreaterOrEqual(t, randInt, int64(0))
126+
assert.LessOrEqual(t, randInt, int64(255))
127127
assert.NoError(t, err)
128128
}
129129

services/gitdiff/gitdiff_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ func TestGetDiffRangeWithWhitespaceBehavior(t *testing.T) {
644644
})
645645
assert.NoError(t, err, "Error when diff with %s", behavior)
646646
for _, f := range diffs.Files {
647-
assert.Positive(t, f.Sections, "%s should have sections", f.Name)
647+
assert.NotEmpty(t, f.Sections, "%s should have sections", f.Name)
648648
}
649649
}
650650
}

tests/integration/api_notification_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func TestAPINotification(t *testing.T) {
154154
AddTokenAuth(token)
155155
resp = MakeRequest(t, req, http.StatusOK)
156156
DecodeJSON(t, resp, &newStruct)
157-
assert.Equal(t, 0, newStruct.New)
157+
assert.Zero(t, newStruct.New)
158158
}
159159

160160
func TestAPINotificationPUT(t *testing.T) {

tests/integration/api_repo_lfs_locks_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,6 @@ func TestAPILFSLocksLogged(t *testing.T) {
176176
resp := session.MakeRequest(t, req, http.StatusOK)
177177
var lfsLocks api.LFSLockList
178178
DecodeJSON(t, resp, &lfsLocks)
179-
assert.Empty(t, lfsLocks.Locks, 0)
179+
assert.Empty(t, lfsLocks.Locks)
180180
}
181181
}

tests/integration/mirror_push_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func testMirrorPush(t *testing.T, u *url.URL) {
7878
assert.True(t, doRemovePushMirror(t, session, user.Name, srcRepo.Name, mirrors[0].ID))
7979
mirrors, _, err = repo_model.GetPushMirrorsByRepoID(db.DefaultContext, srcRepo.ID, db.ListOptions{})
8080
assert.NoError(t, err)
81-
assert.Empty(t, mirrors, 0)
81+
assert.Empty(t, mirrors)
8282
}
8383

8484
func testCreatePushMirror(t *testing.T, session *TestSession, owner, repo, address, username, password, interval string) {

0 commit comments

Comments
 (0)