blob: af5b1bd709cd3744fb069e6295ac3e41c5b011b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// 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 SetMockAuth(t *testing.T, otps AuthOpts) {
before := Auth
Auth = otps
t.Cleanup(func() {
Auth = 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
})
}
|