Replacing require.nil in api layer (#16906)

* Replacing require.nil in api layer

* Fixing some tests

* Fixing tests

* Addressing PR review comments

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Jesús Espino
2021-02-17 09:52:18 +01:00
коммит произвёл GitHub
родитель 9992a27a90
Коммит 31a80a5351
22 изменённых файлов: 226 добавлений и 227 удалений

Просмотреть файл

@@ -129,7 +129,7 @@ func TestCreateEmoji(t *testing.T) {
}
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, app.MaxEmojiOriginalWidth+1), "image.gif")
require.Error(t, resp.Error, "should fail - emoji is too wide")
require.NotNil(t, resp.Error, "should fail - emoji is too wide")
// try to create an emoji that's too tall
emoji = &model.Emoji{
@@ -138,7 +138,7 @@ func TestCreateEmoji(t *testing.T) {
}
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, app.MaxEmojiOriginalHeight+1, 10), "image.gif")
require.Error(t, resp.Error, "should fail - emoji is too tall")
require.NotNil(t, resp.Error, "should fail - emoji is too tall")
// try to create an emoji that's too large
emoji = &model.Emoji{
@@ -147,7 +147,7 @@ func TestCreateEmoji(t *testing.T) {
}
_, resp = Client.CreateEmoji(emoji, utils.CreateTestAnimatedGif(t, 100, 100, 10000), "image.gif")
require.Error(t, resp.Error, "should fail - emoji is too big")
require.NotNil(t, resp.Error, "should fail - emoji is too big")
// try to create an emoji with data that isn't an image
emoji = &model.Emoji{
@@ -290,7 +290,7 @@ func TestDeleteEmoji(t *testing.T) {
_, resp = Client.GetEmoji(newEmoji.Id)
require.NotNil(t, resp, "nil response")
require.Error(t, resp.Error, "expected error fetching deleted emoji")
require.NotNil(t, resp.Error, "expected error fetching deleted emoji")
//Admin can delete other users emoji
newEmoji, resp = Client.CreateEmoji(emoji, utils.CreateTestGif(t, 10, 10), "image.gif")
@@ -302,7 +302,7 @@ func TestDeleteEmoji(t *testing.T) {
_, resp = th.SystemAdminClient.GetEmoji(newEmoji.Id)
require.NotNil(t, resp, "nil response")
require.Error(t, resp.Error, "expected error fetching deleted emoji")
require.NotNil(t, resp.Error, "expected error fetching deleted emoji")
// Try to delete just deleted emoji
_, resp = Client.DeleteEmoji(newEmoji.Id)