mirror of
https://github.com/go-gitea/gitea
synced 2025-07-07 19:17:21 +00:00
Refactor some tests (#34580)
1. use `test.MockVariableValue` as much as possible 2. avoid `time.Sleep` as much as possible
This commit is contained in:
@ -7,6 +7,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@ -47,7 +48,7 @@ func Test_IsValidURL(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_IsValidExternalURL(t *testing.T) {
|
||||
setting.AppURL = "https://try.gitea.io/"
|
||||
defer test.MockVariableValue(&setting.AppURL, "https://try.gitea.io/")()
|
||||
|
||||
cases := []struct {
|
||||
description string
|
||||
@ -89,7 +90,7 @@ func Test_IsValidExternalURL(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_IsValidExternalTrackerURLFormat(t *testing.T) {
|
||||
setting.AppURL = "https://try.gitea.io/"
|
||||
defer test.MockVariableValue(&setting.AppURL, "https://try.gitea.io/")()
|
||||
|
||||
cases := []struct {
|
||||
description string
|
||||
|
Reference in New Issue
Block a user