[MM-54024] Handle JSON nulls when unmarshalling in api4 (#24656)

* handle JSON nulls when unmarshalling in api4

* catch more cases of unhandled JSON null

* fix lint issues

* remove unnecessary checks

* add bot tests for null values

* fix bot_test lint

* add channel null tests

* add group null tests

* add notify_admin null tests

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Delaney Sylvans
2023-10-05 14:55:59 +01:00
коммит произвёл GitHub
родитель 5b25519890
Коммит d61364a24a
14 изменённых файлов: 130 добавлений и 29 удалений

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

@@ -13,6 +13,17 @@ import (
)
func TestNotifyAdmin(t *testing.T) {
t.Run("error when notifying with empty data", func(t *testing.T) {
th := Setup(t).InitBasic().InitLogin()
defer th.TearDown()
statusCode, err := th.Client.NotifyAdmin(context.Background(), nil)
require.Error(t, err)
require.Equal(t, http.StatusBadRequest, statusCode)
})
t.Run("error when plan is unknown when notifying on upgrade", func(t *testing.T) {
th := Setup(t).InitBasic().InitLogin()
defer th.TearDown()