diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2018-09-10 07:38:04 -0400 |
---|---|---|
committer | Martin Kraft <martinkraft@gmail.com> | 2018-09-10 07:38:04 -0400 |
commit | e39ab5c7dcfd6f16264b4a601aca7fa5a572dccf (patch) | |
tree | 99f5746add4fc4c915ab3a9d53a6b39e9b2ccbb4 /api4/emoji_test.go | |
parent | 0027d998555d47f9a75a896d8c6c85a8b4645ad0 (diff) | |
download | chat-e39ab5c7dcfd6f16264b4a601aca7fa5a572dccf.tar.gz chat-e39ab5c7dcfd6f16264b4a601aca7fa5a572dccf.tar.bz2 chat-e39ab5c7dcfd6f16264b4a601aca7fa5a572dccf.zip |
MM-12007 Add max dimensions to emoji images (#9379)
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 1a9dc8e0f..e3aca4497 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 |