[TESTS] enable AddFixtures in unit tests

Use setting.AppWorkPath instead of filepath.Dir(setting.AppPath). It
is the common denominator between:

* models/unittest/testdb.go:MainTest
* tests/test_utils.go:InitTest

which makes it usable in unit tests as well as integration tests.
This commit is contained in:
Earl Warren 2024-03-03 11:11:26 +08:00
parent 3f68525ae4
commit ad547edf3b
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -271,8 +271,8 @@ func Printf(format string, args ...any) {
func AddFixtures(dirs ...string) func() {
return unittest.OverrideFixtures(
unittest.FixturesOptions{
Dir: filepath.Join(filepath.Dir(setting.AppPath), "models/fixtures/"),
Base: filepath.Dir(setting.AppPath),
Dir: filepath.Join(setting.AppWorkPath, "models/fixtures/"),
Base: setting.AppWorkPath,
Dirs: dirs,
},
)