forked from kevadesu/forgejo
Refactor tests (#26464)
1. Give the global variable clear names 2. Use generic parameter for `onGiteaRun`
This commit is contained in:
parent
bcccf4c0d6
commit
c28e29fd94
12 changed files with 65 additions and 127 deletions
|
@ -28,7 +28,7 @@ import (
|
|||
"code.gitea.io/gitea/tests"
|
||||
)
|
||||
|
||||
var c *web.Route
|
||||
var testE2eWebRoutes *web.Route
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
defer log.GetManager().Close()
|
||||
|
@ -38,7 +38,7 @@ func TestMain(m *testing.M) {
|
|||
defer cancel()
|
||||
|
||||
tests.InitTest(false)
|
||||
c = routers.NormalRoutes()
|
||||
testE2eWebRoutes = routers.NormalRoutes()
|
||||
|
||||
os.Unsetenv("GIT_AUTHOR_NAME")
|
||||
os.Unsetenv("GIT_AUTHOR_EMAIL")
|
||||
|
|
|
@ -22,7 +22,7 @@ func onGiteaRunTB(t testing.TB, callback func(testing.TB, *url.URL), prepare ...
|
|||
defer tests.PrepareTestEnv(t, 1)()
|
||||
}
|
||||
s := http.Server{
|
||||
Handler: c,
|
||||
Handler: testE2eWebRoutes,
|
||||
}
|
||||
|
||||
u, err := url.Parse(setting.AppURL)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue