From f860a6d2e4177ed4f4c2a58a07882bd00a1a52ad Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 17 Oct 2022 07:29:26 +0800 Subject: Add system setting table with cache and also add cache supports for user setting (#18058) --- models/unittest/testdb.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'models/unittest') 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) -- cgit v1.2.3