[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
This commit is contained in:
tobi 2022-10-14 17:30:04 +02:00 committed by GitHub
commit f7416d6e94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 369 additions and 0 deletions

View file

@ -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)