From ad547edf3b291aca5dce1773bf1b6bb3601774e0 Mon Sep 17 00:00:00 2001
From: Earl Warren <contact@earl-warren.org>
Date: Sun, 3 Mar 2024 11:11:26 +0800
Subject: [PATCH] [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.
---
 tests/test_utils.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/test_utils.go b/tests/test_utils.go
index 8e456783cf..85d7462d73 100644
--- a/tests/test_utils.go
+++ b/tests/test_utils.go
@@ -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,
 		},
 	)