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:
parent
fa9191b7b9
commit
2a02734f93
42 changed files with 218 additions and 348 deletions
|
@ -12,7 +12,7 @@ import (
|
|||
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func setDefaultBranch(t *testing.T, session *TestSession, user, repo, branch string) {
|
||||
|
@ -199,14 +199,10 @@ func TestNonAsciiBranches(t *testing.T) {
|
|||
t.Run(test.from, func(t *testing.T) {
|
||||
req := NewRequest(t, "GET", fmt.Sprintf("/%s/%s/src/%s", user, repo, test.from))
|
||||
resp := session.MakeRequest(t, req, http.StatusSeeOther)
|
||||
if resp.Code != http.StatusSeeOther {
|
||||
return
|
||||
}
|
||||
require.Equal(t, http.StatusSeeOther, resp.Code)
|
||||
|
||||
redirectLocation := resp.Header().Get("Location")
|
||||
if !assert.Equal(t, fmt.Sprintf("/%s/%s/src/%s", user, repo, test.to), redirectLocation) {
|
||||
return
|
||||
}
|
||||
require.Equal(t, fmt.Sprintf("/%s/%s/src/%s", user, repo, test.to), redirectLocation)
|
||||
|
||||
req = NewRequest(t, "GET", redirectLocation)
|
||||
session.MakeRequest(t, req, test.status)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue