From f7416d6e941df6fe016d66bb5b53d633775c1f6f Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Fri, 14 Oct 2022 17:30:04 +0200 Subject: [feature] Add emoji DELETE handler at `/api/v1/admin/custom_emojis` (#913) * add emoji DELETE handler * no need to process error (thanks kim) * don't double check if user is admin * add missing security annotation --- internal/db/bundb/emoji_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'internal/db/bundb/emoji_test.go') diff --git a/internal/db/bundb/emoji_test.go b/internal/db/bundb/emoji_test.go index c6577a721..b542f9b67 100644 --- a/internal/db/bundb/emoji_test.go +++ b/internal/db/bundb/emoji_test.go @@ -38,6 +38,17 @@ func (suite *EmojiTestSuite) TestGetUseableEmojis() { suite.Equal("rainbow", emojis[0].Shortcode) } +func (suite *EmojiTestSuite) TestDeleteEmojiByID() { + testEmoji := suite.testEmojis["rainbow"] + + err := suite.db.DeleteEmojiByID(context.Background(), testEmoji.ID) + suite.NoError(err) + + dbEmoji, err := suite.db.GetEmojiByID(context.Background(), testEmoji.ID) + suite.Nil(dbEmoji) + suite.ErrorIs(err, db.ErrNoEntries) +} + func (suite *EmojiTestSuite) TestGetEmojiByStaticURL() { emoji, err := suite.db.GetEmojiByStaticURL(context.Background(), "http://localhost:8080/fileserver/01F8MH17FWEB39HZJ76B6VXSKF/emoji/static/01F8MH9H8E4VG3KDYJR9EGPXCQ.png") suite.NoError(err) -- cgit v1.2.3