summaryrefslogtreecommitdiffstats
path: root/models/unittest
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2022-10-17 07:29:26 +0800
committerGitHub <noreply@github.com>2022-10-17 07:29:26 +0800
commitf860a6d2e4177ed4f4c2a58a07882bd00a1a52ad (patch)
tree93abb2f354576e50c87d70b0b4bb46369fb3a1f1 /models/unittest
parent5d3dbffa150d832d2f9aedd9f90ca91178a95f9c (diff)
downloadgitea-f860a6d2e4177ed4f4c2a58a07882bd00a1a52ad.tar.gz
gitea-f860a6d2e4177ed4f4c2a58a07882bd00a1a52ad.zip
Add system setting table with cache and also add cache supports for user setting (#18058)
Diffstat (limited to 'models/unittest')
-rw-r--r--models/unittest/testdb.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/models/unittest/testdb.go b/models/unittest/testdb.go
index 25129137f7..2e6c25ae48 100644
--- a/models/unittest/testdb.go
+++ b/models/unittest/testdb.go
@@ -7,12 +7,12 @@ package unittest
import (
"context"
"fmt"
- "net/url"
"os"
"path/filepath"
"testing"
"code.gitea.io/gitea/models/db"
+ system_model "code.gitea.io/gitea/models/system"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/setting"
@@ -91,10 +91,8 @@ func MainTest(m *testing.M, testOpts *TestOptions) {
setting.AppDataPath = appDataPath
setting.AppWorkPath = testOpts.GiteaRootPath
setting.StaticRootPath = testOpts.GiteaRootPath
- setting.GravatarSourceURL, err = url.Parse("https://secure.gravatar.com/avatar/")
- if err != nil {
- fatalTestError("url.Parse: %v\n", err)
- }
+ setting.GravatarSource = "https://secure.gravatar.com/avatar/"
+
setting.Attachment.Storage.Path = filepath.Join(setting.AppDataPath, "attachments")
setting.LFS.Storage.Path = filepath.Join(setting.AppDataPath, "lfs")
@@ -112,6 +110,9 @@ func MainTest(m *testing.M, testOpts *TestOptions) {
if err = storage.Init(); err != nil {
fatalTestError("storage.Init: %v\n", err)
}
+ if err = system_model.Init(); err != nil {
+ fatalTestError("models.Init: %v\n", err)
+ }
if err = util.RemoveAll(repoRootPath); err != nil {
fatalTestError("util.RemoveAll: %v\n", err)