gogs/internal/conf/mocks.go
Joe Chen 083c3ee659
db: refactor "action" table to use GORM (#7054)
Co-authored-by: deepsource-autofix[bot] <62050782+deepsource-autofix[bot]@users.noreply.github.com>
2022-06-25 18:07:39 +08:00

50 lines
818 B
Go

// Copyright 2020 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package conf
import (
"testing"
)
func SetMockApp(t *testing.T, opts AppOpts) {
before := App
App = opts
t.Cleanup(func() {
App = before
})
}
func SetMockServer(t *testing.T, opts ServerOpts) {
before := Server
Server = opts
t.Cleanup(func() {
Server = before
})
}
func SetMockSSH(t *testing.T, opts SSHOpts) {
before := SSH
SSH = opts
t.Cleanup(func() {
SSH = before
})
}
func SetMockRepository(t *testing.T, opts RepositoryOpts) {
before := Repository
Repository = opts
t.Cleanup(func() {
Repository = before
})
}
func SetMockUI(t *testing.T, opts UIOpts) {
before := UI
UI = opts
t.Cleanup(func() {
UI = before
})
}