From e43a46e9822a05dd0345a7676e03285ddf83205e Mon Sep 17 00:00:00 2001 From: "kim (grufwub)" Date: Sat, 11 Sep 2021 20:12:47 +0100 Subject: add git.iim.gay/grufwub/go-store for storage backend, replacing blob.Storage Signed-off-by: kim (grufwub) --- internal/api/client/media/mediacreate_test.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'internal/api/client/media/mediacreate_test.go') diff --git a/internal/api/client/media/mediacreate_test.go b/internal/api/client/media/mediacreate_test.go index 1b2c84cf9..53c1ce996 100644 --- a/internal/api/client/media/mediacreate_test.go +++ b/internal/api/client/media/mediacreate_test.go @@ -28,13 +28,13 @@ import ( "net/http/httptest" "testing" + "git.iim.gay/grufwub/go-store/kv" "github.com/gin-gonic/gin" "github.com/sirupsen/logrus" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" mediamodule "github.com/superseriousbusiness/gotosocial/internal/api/client/media" "github.com/superseriousbusiness/gotosocial/internal/api/model" - "github.com/superseriousbusiness/gotosocial/internal/blob" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/federation" @@ -52,7 +52,7 @@ type MediaCreateTestSuite struct { config *config.Config db db.DB log *logrus.Logger - storage blob.Storage + storage *kv.KVStore federator federation.Federator tc typeutils.TypeConverter mediaHandler media.Handler @@ -118,7 +118,6 @@ func (suite *MediaCreateTestSuite) TearDownTest() { */ func (suite *MediaCreateTestSuite) TestStatusCreatePOSTImageHandlerSuccessful() { - // set up the context for the request t := suite.testTokens["local_account_1"] oauthToken := oauth.DBTokenToToken(t) @@ -130,10 +129,15 @@ func (suite *MediaCreateTestSuite) TestStatusCreatePOSTImageHandlerSuccessful() ctx.Set(oauth.SessionAuthorizedAccount, suite.testAccounts["local_account_1"]) // see what's in storage *before* the request - storageKeysBeforeRequest, err := suite.storage.ListKeys() + storageKeysBeforeRequest := []string{} + iter, err := suite.storage.Iterator(nil) if err != nil { panic(err) } + for iter.Next() { + storageKeysBeforeRequest = append(storageKeysBeforeRequest, iter.Key()) + } + iter.Release() // create the request buf, w, err := testrig.CreateMultipartFormData("file", "../../../../testrig/media/test-jpeg.jpg", map[string]string{ @@ -150,10 +154,15 @@ func (suite *MediaCreateTestSuite) TestStatusCreatePOSTImageHandlerSuccessful() suite.mediaModule.MediaCreatePOSTHandler(ctx) // check what's in storage *after* the request - storageKeysAfterRequest, err := suite.storage.ListKeys() + storageKeysAfterRequest := []string{} + iter, err = suite.storage.Iterator(nil) if err != nil { panic(err) } + for iter.Next() { + storageKeysAfterRequest = append(storageKeysAfterRequest, iter.Key()) + } + iter.Release() // check response suite.EqualValues(http.StatusOK, recorder.Code) -- cgit v1.2.3