Skip to content

Commit

Permalink
fix type errors in asserts
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFox0x7 committed Dec 15, 2024
1 parent f1d3eb1 commit 42eb511
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion models/user/email_address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func TestListEmails(t *testing.T) {
}
emails, count, err := user_model.SearchEmails(db.DefaultContext, opts)
assert.NoError(t, err)
assert.Greater(t, count, 5)
assert.Greater(t, count, int64(5))

contains := func(match func(s *user_model.SearchEmailResult) bool) bool {
for _, v := range emails {
Expand Down
2 changes: 1 addition & 1 deletion modules/auth/pam/pam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ func TestPamAuth(t *testing.T) {
result, err := Auth("gitea", "user1", "false-pwd")
assert.Error(t, err)
assert.EqualError(t, err, "Authentication failure")
assert.Len(t, result, 0)
assert.Len(t, result)
}
4 changes: 2 additions & 2 deletions modules/util/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ func Test_NormalizeEOL(t *testing.T) {

func Test_RandomInt(t *testing.T) {
randInt, err := CryptoRandomInt(255)
assert.GreaterOrEqual(t, randInt, 0)
assert.LessOrEqual(t, randInt, 255)
assert.GreaterOrEqual(t, randInt, int64(0))
assert.LessOrEqual(t, randInt, int64(255))
assert.NoError(t, err)
}

Expand Down
2 changes: 1 addition & 1 deletion services/gitdiff/gitdiff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ func TestGetDiffRangeWithWhitespaceBehavior(t *testing.T) {
})
assert.NoError(t, err, "Error when diff with %s", behavior)
for _, f := range diffs.Files {
assert.Positive(t, f.Sections, "%s should have sections", f.Name)
assert.NotEmpty(t, f.Sections, "%s should have sections", f.Name)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/api_notification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func TestAPINotification(t *testing.T) {
AddTokenAuth(token)
resp = MakeRequest(t, req, http.StatusOK)
DecodeJSON(t, resp, &newStruct)
assert.Equal(t, 0, newStruct.New)
assert.Zero(t, newStruct.New)
}

func TestAPINotificationPUT(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/api_repo_lfs_locks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,6 @@ func TestAPILFSLocksLogged(t *testing.T) {
resp := session.MakeRequest(t, req, http.StatusOK)
var lfsLocks api.LFSLockList
DecodeJSON(t, resp, &lfsLocks)
assert.Empty(t, lfsLocks.Locks, 0)
assert.Empty(t, lfsLocks.Locks)
}
}
2 changes: 1 addition & 1 deletion tests/integration/mirror_push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func testMirrorPush(t *testing.T, u *url.URL) {
assert.True(t, doRemovePushMirror(t, session, user.Name, srcRepo.Name, mirrors[0].ID))
mirrors, _, err = repo_model.GetPushMirrorsByRepoID(db.DefaultContext, srcRepo.ID, db.ListOptions{})
assert.NoError(t, err)
assert.Empty(t, mirrors, 0)
assert.Empty(t, mirrors)
}

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

0 comments on commit 42eb511

Please sign in to comment.