From 5e060d0bcb9af77e7b6d11acba99db6219d4f68e Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Sat, 10 Dec 2022 22:43:11 +0100 Subject: [feature] Start implementing refetch of lost media files via `/api/v1/admin/media_refetch` (#1221) * [chore] Move ShortcodeDomain to its own little util func * [feature] Add RefetchEmojis function to media manager * [feature] Expose admin media refresh via admin API * update following review feedback - change/fix log levels - make sure not to try to refetch local emojis - small style refactoring + comments * log on emoji refetch start Signed-off-by: kim Co-authored-by: kim --- internal/media/media_test.go | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'internal/media/media_test.go') diff --git a/internal/media/media_test.go b/internal/media/media_test.go index 435994073..05408497c 100644 --- a/internal/media/media_test.go +++ b/internal/media/media_test.go @@ -20,22 +20,26 @@ package media_test import ( "github.com/stretchr/testify/suite" + "github.com/superseriousbusiness/gotosocial/internal/concurrency" "github.com/superseriousbusiness/gotosocial/internal/db" gtsmodel "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/media" + "github.com/superseriousbusiness/gotosocial/internal/messages" "github.com/superseriousbusiness/gotosocial/internal/storage" + "github.com/superseriousbusiness/gotosocial/internal/transport" "github.com/superseriousbusiness/gotosocial/testrig" ) type MediaStandardTestSuite struct { suite.Suite - db db.DB - storage *storage.Driver - manager media.Manager - testAttachments map[string]*gtsmodel.MediaAttachment - testAccounts map[string]*gtsmodel.Account - testEmojis map[string]*gtsmodel.Emoji + db db.DB + storage *storage.Driver + manager media.Manager + transportController transport.Controller + testAttachments map[string]*gtsmodel.MediaAttachment + testAccounts map[string]*gtsmodel.Account + testEmojis map[string]*gtsmodel.Emoji } func (suite *MediaStandardTestSuite) SetupSuite() { @@ -53,6 +57,7 @@ func (suite *MediaStandardTestSuite) SetupTest() { suite.testAccounts = testrig.NewTestAccounts() suite.testEmojis = testrig.NewTestEmojis() suite.manager = testrig.NewTestMediaManager(suite.db, suite.storage) + suite.transportController = testrig.NewTestTransportController(testrig.NewMockHTTPClient(nil, "../../testrig/media"), suite.db, concurrency.NewWorkerPool[messages.FromFederator](0, 0)) } func (suite *MediaStandardTestSuite) TearDownTest() { -- cgit v1.2.3