aboutsummaryrefslogtreecommitdiffstats
path: root/modules/repository
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 /modules/repository
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 'modules/repository')
-rw-r--r--modules/repository/commits_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/repository/commits_test.go b/modules/repository/commits_test.go
index c62e324b66..7bd741d0c8 100644
--- a/modules/repository/commits_test.go
+++ b/modules/repository/commits_test.go
@@ -11,8 +11,10 @@ import (
"time"
repo_model "code.gitea.io/gitea/models/repo"
+ system_model "code.gitea.io/gitea/models/system"
"code.gitea.io/gitea/models/unittest"
"code.gitea.io/gitea/modules/git"
+ "code.gitea.io/gitea/modules/setting"
"github.com/stretchr/testify/assert"
)
@@ -100,6 +102,14 @@ func TestPushCommits_ToAPIPayloadCommits(t *testing.T) {
assert.EqualValues(t, []string{"readme.md"}, headCommit.Modified)
}
+func enableGravatar(t *testing.T) {
+ err := system_model.SetSettingNoVersion(system_model.KeyPictureDisableGravatar, "false")
+ assert.NoError(t, err)
+ setting.GravatarSource = "https://secure.gravatar.com/avatar"
+ err = system_model.Init()
+ assert.NoError(t, err)
+}
+
func TestPushCommits_AvatarLink(t *testing.T) {
assert.NoError(t, unittest.PrepareTestDatabase())
@@ -123,6 +133,8 @@ func TestPushCommits_AvatarLink(t *testing.T) {
},
}
+ enableGravatar(t)
+
assert.Equal(t,
"https://secure.gravatar.com/avatar/ab53a2911ddf9b4817ac01ddcd3d975f?d=identicon&s=84",
pushCommits.AvatarLink("user2@example.com"))