aboutsummaryrefslogtreecommitdiffstats
path: root/modules/repository/commits_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/repository/commits_test.go')
-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"))