mirror of
https://github.com/go-gitea/gitea
synced 2025-07-10 04:27:22 +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:
@ -6,6 +6,8 @@ package setting
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@ -36,12 +38,8 @@ diff.algorithm = other
|
||||
}
|
||||
|
||||
func TestGitReflog(t *testing.T) {
|
||||
oldGit := Git
|
||||
oldGitConfig := GitConfig
|
||||
defer func() {
|
||||
Git = oldGit
|
||||
GitConfig = oldGitConfig
|
||||
}()
|
||||
defer test.MockVariableValue(&Git)
|
||||
defer test.MockVariableValue(&GitConfig)
|
||||
|
||||
// default reflog config without legacy options
|
||||
cfg, err := NewConfigProviderFromData(``)
|
||||
|
Reference in New Issue
Block a user