Refactor older tests to use testify (#33140)

Refactor checks to use assert/require
Use require.Eventually for waiting in elastic and meilisearch tests
Use require to exit early instead of assert
This commit is contained in:
TheFox0x7 2025-01-09 02:21:47 +01:00 committed by GitHub
parent fa9191b7b9
commit 2a02734f93
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
42 changed files with 218 additions and 348 deletions

View file

@ -15,6 +15,7 @@ import (
"code.gitea.io/gitea/tests"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestAPIPullCommits(t *testing.T) {
@ -29,9 +30,7 @@ func TestAPIPullCommits(t *testing.T) {
var commits []*api.Commit
DecodeJSON(t, resp, &commits)
if !assert.Len(t, commits, 2) {
return
}
require.Len(t, commits, 2)
assert.Equal(t, "985f0301dba5e7b34be866819cd15ad3d8f508ee", commits[0].SHA)
assert.Equal(t, "5c050d3b6d2db231ab1f64e324f1b6b9a0b181c2", commits[1].SHA)