diff options
author | Jason Song <i@wolfogre.com> | 2023-03-01 06:17:51 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-28 16:17:51 -0600 |
commit | 04347eb810689db799003cc342bbbc756716ff12 (patch) | |
tree | a7131234f7f93717d8988cf39cc04e277823ceb7 /services/repository/avatar_test.go | |
parent | cbbd3726b4edb3c2bda59610050fd5af149fbdb1 (diff) | |
download | gitea-04347eb810689db799003cc342bbbc756716ff12.tar.gz gitea-04347eb810689db799003cc342bbbc756716ff12.zip |
Use context parameter in services/repository (#23186)
Use context parameter in `services/repository`.
And use `cache.WithCacheContext(ctx)` to generate push action history
feeds.
Fix #23160
Diffstat (limited to 'services/repository/avatar_test.go')
-rw-r--r-- | services/repository/avatar_test.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/services/repository/avatar_test.go b/services/repository/avatar_test.go index 5ec899ec3f..4a0ba61853 100644 --- a/services/repository/avatar_test.go +++ b/services/repository/avatar_test.go @@ -9,6 +9,7 @@ import ( "image/png" "testing" + "code.gitea.io/gitea/models/db" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" "code.gitea.io/gitea/modules/avatar" @@ -25,7 +26,7 @@ func TestUploadAvatar(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 10}) - err := UploadAvatar(repo, buff.Bytes()) + err := UploadAvatar(db.DefaultContext, repo, buff.Bytes()) assert.NoError(t, err) assert.Equal(t, avatar.HashAvatar(10, buff.Bytes()), repo.Avatar) } @@ -39,7 +40,7 @@ func TestUploadBigAvatar(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 10}) - err := UploadAvatar(repo, buff.Bytes()) + err := UploadAvatar(db.DefaultContext, repo, buff.Bytes()) assert.Error(t, err) } @@ -52,10 +53,10 @@ func TestDeleteAvatar(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 10}) - err := UploadAvatar(repo, buff.Bytes()) + err := UploadAvatar(db.DefaultContext, repo, buff.Bytes()) assert.NoError(t, err) - err = DeleteAvatar(repo) + err = DeleteAvatar(db.DefaultContext, repo) assert.NoError(t, err) assert.Equal(t, "", repo.Avatar) |