summaryrefslogtreecommitdiffstats
path: root/api4/emoji_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2018-01-24 08:50:11 -0500
committerGitHub <noreply@github.com>2018-01-24 08:50:11 -0500
commit3918ed6c589a19bd385a6e566f07dc14d7484c49 (patch)
treef4a827a00e50eab1d47a70a6a85d369c44c84940 /api4/emoji_test.go
parentf2415b98f652bc695d3825e54ac832ee468c0a63 (diff)
downloadchat-3918ed6c589a19bd385a6e566f07dc14d7484c49.tar.gz
chat-3918ed6c589a19bd385a6e566f07dc14d7484c49.tar.bz2
chat-3918ed6c589a19bd385a6e566f07dc14d7484c49.zip
Add GET /emojis/name/{emoji_name} API endpoint (#8142)
Diffstat (limited to 'api4/emoji_test.go')
-rw-r--r--api4/emoji_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/api4/emoji_test.go b/api4/emoji_test.go
index b8b093656..39da4aaef 100644
--- a/api4/emoji_test.go
+++ b/api4/emoji_test.go
@@ -316,6 +316,33 @@ func TestGetEmoji(t *testing.T) {
CheckNotFoundStatus(t, resp)
}
+func TestGetEmojiByName(t *testing.T) {
+ th := Setup().InitBasic()
+ defer th.TearDown()
+ Client := th.Client
+
+ th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableCustomEmoji = true })
+
+ emoji := &model.Emoji{
+ CreatorId: th.BasicUser.Id,
+ Name: model.NewId(),
+ }
+
+ newEmoji, resp := Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, 10), "image.gif")
+ CheckNoError(t, resp)
+
+ emoji, resp = Client.GetEmojiByName(newEmoji.Name)
+ CheckNoError(t, resp)
+ assert.Equal(t, newEmoji.Name, emoji.Name)
+
+ _, resp = Client.GetEmojiByName(model.NewId())
+ CheckNotFoundStatus(t, resp)
+
+ Client.Logout()
+ _, resp = Client.GetEmojiByName(newEmoji.Name)
+ CheckUnauthorizedStatus(t, resp)
+}
+
func TestGetEmojiImage(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()