From d2b3d37724a999d4cc78c46157593267e29d184e Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Tue, 18 Jun 2024 18:18:00 +0200 Subject: [feature/frontend] Reports frontend v2 (#3022) * use apiutil + paging in admin processor+handlers * we're making it happen * fix little whoopsie * styling for report list * don't youuuu forget about meee don't don't don't don't * last bits * sanitize content before showing in report statuses * update report docs --- internal/api/client/admin/emojiupdate_test.go | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'internal/api/client/admin/emojiupdate_test.go') diff --git a/internal/api/client/admin/emojiupdate_test.go b/internal/api/client/admin/emojiupdate_test.go index eb9d9d866..676363e39 100644 --- a/internal/api/client/admin/emojiupdate_test.go +++ b/internal/api/client/admin/emojiupdate_test.go @@ -28,6 +28,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/superseriousbusiness/gotosocial/internal/api/client/admin" apimodel "github.com/superseriousbusiness/gotosocial/internal/api/model" + apiutil "github.com/superseriousbusiness/gotosocial/internal/api/util" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/testrig" ) @@ -53,7 +54,7 @@ func (suite *EmojiUpdateTestSuite) TestEmojiUpdateNewCategory() { bodyBytes := requestBody.Bytes() recorder := httptest.NewRecorder() ctx := suite.newContext(recorder, http.MethodPost, bodyBytes, admin.EmojiPathWithID, w.FormDataContentType()) - ctx.AddParam(admin.IDKey, testEmoji.ID) + ctx.AddParam(apiutil.IDKey, testEmoji.ID) // call the handler suite.adminModule.EmojiPATCHHandler(ctx) @@ -130,7 +131,7 @@ func (suite *EmojiUpdateTestSuite) TestEmojiUpdateSwitchCategory() { bodyBytes := requestBody.Bytes() recorder := httptest.NewRecorder() ctx := suite.newContext(recorder, http.MethodPost, bodyBytes, admin.EmojiPathWithID, w.FormDataContentType()) - ctx.AddParam(admin.IDKey, testEmoji.ID) + ctx.AddParam(apiutil.IDKey, testEmoji.ID) // call the handler suite.adminModule.EmojiPATCHHandler(ctx) @@ -208,7 +209,7 @@ func (suite *EmojiUpdateTestSuite) TestEmojiUpdateCopyRemoteToLocal() { bodyBytes := requestBody.Bytes() recorder := httptest.NewRecorder() ctx := suite.newContext(recorder, http.MethodPost, bodyBytes, admin.EmojiPathWithID, w.FormDataContentType()) - ctx.AddParam(admin.IDKey, testEmoji.ID) + ctx.AddParam(apiutil.IDKey, testEmoji.ID) // call the handler suite.adminModule.EmojiPATCHHandler(ctx) @@ -284,7 +285,7 @@ func (suite *EmojiUpdateTestSuite) TestEmojiUpdateDisableEmoji() { bodyBytes := requestBody.Bytes() recorder := httptest.NewRecorder() ctx := suite.newContext(recorder, http.MethodPost, bodyBytes, admin.EmojiPathWithID, w.FormDataContentType()) - ctx.AddParam(admin.IDKey, testEmoji.ID) + ctx.AddParam(apiutil.IDKey, testEmoji.ID) // call the handler suite.adminModule.EmojiPATCHHandler(ctx) @@ -325,7 +326,7 @@ func (suite *EmojiUpdateTestSuite) TestEmojiUpdateDisableLocalEmoji() { bodyBytes := requestBody.Bytes() recorder := httptest.NewRecorder() ctx := suite.newContext(recorder, http.MethodPost, bodyBytes, admin.EmojiPathWithID, w.FormDataContentType()) - ctx.AddParam(admin.IDKey, testEmoji.ID) + ctx.AddParam(apiutil.IDKey, testEmoji.ID) // call the handler suite.adminModule.EmojiPATCHHandler(ctx) @@ -358,7 +359,7 @@ func (suite *EmojiUpdateTestSuite) TestEmojiUpdateModifyRemoteEmoji() { bodyBytes := requestBody.Bytes() recorder := httptest.NewRecorder() ctx := suite.newContext(recorder, http.MethodPost, bodyBytes, admin.EmojiPathWithID, w.FormDataContentType()) - ctx.AddParam(admin.IDKey, testEmoji.ID) + ctx.AddParam(apiutil.IDKey, testEmoji.ID) // call the handler suite.adminModule.EmojiPATCHHandler(ctx) @@ -391,7 +392,7 @@ func (suite *EmojiUpdateTestSuite) TestEmojiUpdateModifyNoParams() { bodyBytes := requestBody.Bytes() recorder := httptest.NewRecorder() ctx := suite.newContext(recorder, http.MethodPost, bodyBytes, admin.EmojiPathWithID, w.FormDataContentType()) - ctx.AddParam(admin.IDKey, testEmoji.ID) + ctx.AddParam(apiutil.IDKey, testEmoji.ID) // call the handler suite.adminModule.EmojiPATCHHandler(ctx) @@ -425,7 +426,7 @@ func (suite *EmojiUpdateTestSuite) TestEmojiUpdateCopyLocalToLocal() { bodyBytes := requestBody.Bytes() recorder := httptest.NewRecorder() ctx := suite.newContext(recorder, http.MethodPost, bodyBytes, admin.EmojiPathWithID, w.FormDataContentType()) - ctx.AddParam(admin.IDKey, testEmoji.ID) + ctx.AddParam(apiutil.IDKey, testEmoji.ID) // call the handler suite.adminModule.EmojiPATCHHandler(ctx) @@ -459,7 +460,7 @@ func (suite *EmojiUpdateTestSuite) TestEmojiUpdateCopyEmptyShortcode() { bodyBytes := requestBody.Bytes() recorder := httptest.NewRecorder() ctx := suite.newContext(recorder, http.MethodPost, bodyBytes, admin.EmojiPathWithID, w.FormDataContentType()) - ctx.AddParam(admin.IDKey, testEmoji.ID) + ctx.AddParam(apiutil.IDKey, testEmoji.ID) // call the handler suite.adminModule.EmojiPATCHHandler(ctx) @@ -492,7 +493,7 @@ func (suite *EmojiUpdateTestSuite) TestEmojiUpdateCopyNoShortcode() { bodyBytes := requestBody.Bytes() recorder := httptest.NewRecorder() ctx := suite.newContext(recorder, http.MethodPost, bodyBytes, admin.EmojiPathWithID, w.FormDataContentType()) - ctx.AddParam(admin.IDKey, testEmoji.ID) + ctx.AddParam(apiutil.IDKey, testEmoji.ID) // call the handler suite.adminModule.EmojiPATCHHandler(ctx) @@ -526,7 +527,7 @@ func (suite *EmojiUpdateTestSuite) TestEmojiUpdateCopyShortcodeAlreadyInUse() { bodyBytes := requestBody.Bytes() recorder := httptest.NewRecorder() ctx := suite.newContext(recorder, http.MethodPost, bodyBytes, admin.EmojiPathWithID, w.FormDataContentType()) - ctx.AddParam(admin.IDKey, testEmoji.ID) + ctx.AddParam(apiutil.IDKey, testEmoji.ID) // call the handler suite.adminModule.EmojiPATCHHandler(ctx) -- cgit v1.2.3