Skip to content

Commit 9fb3d24

Browse files
committed
Fix test
1 parent 5f87b62 commit 9fb3d24

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

models/asymkey/main_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,14 @@ import (
99
"testing"
1010

1111
"code.gitea.io/gitea/models/unittest"
12+
"code.gitea.io/gitea/modules/setting"
1213
)
1314

15+
func init() {
16+
setting.SetCustomPathAndConf("", "", "")
17+
setting.LoadForTest()
18+
}
19+
1420
func TestMain(m *testing.M) {
1521
unittest.MainTest(m, filepath.Join("..", ".."),
1622
"gpg_key.yml",

models/main_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,16 @@ import (
1010
repo_model "code.gitea.io/gitea/models/repo"
1111
"code.gitea.io/gitea/models/unittest"
1212
user_model "code.gitea.io/gitea/models/user"
13+
"code.gitea.io/gitea/modules/setting"
1314

1415
"github.com/stretchr/testify/assert"
1516
)
1617

18+
func init() {
19+
setting.SetCustomPathAndConf("", "", "")
20+
setting.LoadForTest()
21+
}
22+
1723
// TestFixturesAreConsistent assert that test fixtures are consistent
1824
func TestFixturesAreConsistent(t *testing.T) {
1925
assert.NoError(t, unittest.PrepareTestDatabase())

models/unittest/testdb.go

-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ func fatalTestError(fmtStr string, args ...interface{}) {
4242
// MainTest a reusable TestMain(..) function for unit tests that need to use a
4343
// test database. Creates the test database, and sets necessary settings.
4444
func MainTest(m *testing.M, pathToGiteaRoot string, fixtureFiles ...string) {
45-
setting.SetCustomPathAndConf("", "", "")
46-
setting.LoadForTest()
47-
4845
var err error
4946

5047
giteaRoot = pathToGiteaRoot

0 commit comments

Comments
 (0)