diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2018-09-13 13:10:10 -0400 |
---|---|---|
committer | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2018-09-13 19:10:10 +0200 |
commit | fd21e53365d504155ab87f9bef60b1ab4faeb38d (patch) | |
tree | 90f938af0625c544b3f8cee10efda59a206ccd55 /api4/emoji_test.go | |
parent | 7d60bc8cf57b9e47ad4d07bc4bbf61ee2f23c457 (diff) | |
download | chat-fd21e53365d504155ab87f9bef60b1ab4faeb38d.tar.gz chat-fd21e53365d504155ab87f9bef60b1ab4faeb38d.tar.bz2 chat-fd21e53365d504155ab87f9bef60b1ab4faeb38d.zip |
MM-12007 Add max dimensions to emoji images (5.3) (#9407)
Diffstat (limited to 'api4/emoji_test.go')
-rw-r--r-- | api4/emoji_test.go | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/api4/emoji_test.go b/api4/emoji_test.go index cb6398312..34fa602cc 100644 --- a/api4/emoji_test.go +++ b/api4/emoji_test.go @@ -9,6 +9,7 @@ import ( _ "image/gif" "testing" + "github.com/mattermost/mattermost-server/app" "github.com/mattermost/mattermost-server/model" "github.com/mattermost/mattermost-server/utils" @@ -105,16 +106,26 @@ func TestCreateEmoji(t *testing.T) { t.Fatal("create with wrong name") } + // try to create an emoji that's too wide + emoji = &model.Emoji{ + CreatorId: th.BasicUser.Id, + Name: model.NewId(), + } + + newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, app.MaxEmojiOriginalWidth+1), "image.gif") + if resp.Error == nil { + t.Fatal("should fail - emoji is too wide") + } + // try to create an emoji that's too tall emoji = &model.Emoji{ CreatorId: th.BasicUser.Id, Name: model.NewId(), } - newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, 1000), "image.gif") - CheckNoError(t, resp) - if newEmoji.Name != emoji.Name { - t.Fatal("create with wrong name") + newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, app.MaxEmojiOriginalHeight+1, 10), "image.gif") + if resp.Error == nil { + t.Fatal("should fail - emoji is too tall") } // try to create an emoji that's too large |