summaryrefslogtreecommitdiffstats
path: root/models/avatars/avatar_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/avatars/avatar_test.go')
-rw-r--r--models/avatars/avatar_test.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/models/avatars/avatar_test.go b/models/avatars/avatar_test.go
index 29be2ea346..a3cb36d0e1 100644
--- a/models/avatars/avatar_test.go
+++ b/models/avatars/avatar_test.go
@@ -7,6 +7,7 @@ import (
"testing"
avatars_model "code.gitea.io/gitea/models/avatars"
+ "code.gitea.io/gitea/models/db"
system_model "code.gitea.io/gitea/models/system"
"code.gitea.io/gitea/modules/setting"
@@ -16,15 +17,15 @@ import (
const gravatarSource = "https://secure.gravatar.com/avatar/"
func disableGravatar(t *testing.T) {
- err := system_model.SetSettingNoVersion(system_model.KeyPictureEnableFederatedAvatar, "false")
+ err := system_model.SetSettingNoVersion(db.DefaultContext, system_model.KeyPictureEnableFederatedAvatar, "false")
assert.NoError(t, err)
- err = system_model.SetSettingNoVersion(system_model.KeyPictureDisableGravatar, "true")
+ err = system_model.SetSettingNoVersion(db.DefaultContext, system_model.KeyPictureDisableGravatar, "true")
assert.NoError(t, err)
system_model.LibravatarService = nil
}
func enableGravatar(t *testing.T) {
- err := system_model.SetSettingNoVersion(system_model.KeyPictureDisableGravatar, "false")
+ err := system_model.SetSettingNoVersion(db.DefaultContext, system_model.KeyPictureDisableGravatar, "false")
assert.NoError(t, err)
setting.GravatarSource = gravatarSource
err = system_model.Init()
@@ -47,11 +48,11 @@ func TestSizedAvatarLink(t *testing.T) {
disableGravatar(t)
assert.Equal(t, "/testsuburl/assets/img/avatar_default.png",
- avatars_model.GenerateEmailAvatarFastLink("gitea@example.com", 100))
+ avatars_model.GenerateEmailAvatarFastLink(db.DefaultContext, "gitea@example.com", 100))
enableGravatar(t)
assert.Equal(t,
"https://secure.gravatar.com/avatar/353cbad9b58e69c96154ad99f92bedc7?d=identicon&s=100",
- avatars_model.GenerateEmailAvatarFastLink("gitea@example.com", 100),
+ avatars_model.GenerateEmailAvatarFastLink(db.DefaultContext, "gitea@example.com", 100),
)
}