summaryrefslogtreecommitdiff
path: root/internal/db/bundb/emoji_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-10-14 17:30:04 +0200
committerLibravatar GitHub <noreply@github.com>2022-10-14 17:30:04 +0200
commitf7416d6e941df6fe016d66bb5b53d633775c1f6f (patch)
tree086ee8e0de19ce6f2b8ed8e04ecae3848544b48f /internal/db/bundb/emoji_test.go
parent[feature] Add `/api/v1/admin/custom_emojis/{id}` endpoint for single emoji GE... (diff)
downloadgotosocial-f7416d6e941df6fe016d66bb5b53d633775c1f6f.tar.xz
[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
Diffstat (limited to 'internal/db/bundb/emoji_test.go')
-rw-r--r--internal/db/bundb/emoji_test.go11
1 files changed, 11 insertions, 0 deletions
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)