MM-44805: Avoid pointers in JSON parsing in createCategoryForTeamForUser (#20429)
Passing null is a valid JSON input for a pointer struct. So we avoid passing pointer to pointer. https://mattermost.atlassian.net/browse/MM-44805 ```release-note NONE ```
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
16174cacf0
Коммит
b443746e80
@@ -5,6 +5,7 @@ package api4
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -90,6 +91,17 @@ func TestCreateCategoryForTeamForUser(t *testing.T) {
|
||||
require.Equal(t, int64(10), customCategory.SortOrder)
|
||||
})
|
||||
|
||||
t.Run("should not crash with null input", func(t *testing.T) {
|
||||
require.NotPanics(t, func() {
|
||||
user, client := setupUserForSubtest(t, th)
|
||||
payload := []byte(`null`)
|
||||
route := fmt.Sprintf("/users/%s/teams/%s/channels/categories", user.Id, th.BasicTeam.Id)
|
||||
r, err := client.DoAPIPostBytes(route, payload)
|
||||
require.Error(t, err)
|
||||
closeBody(r)
|
||||
})
|
||||
})
|
||||
|
||||
t.Run("should publish expected WS payload", func(t *testing.T) {
|
||||
t.Skip("MM-42652")
|
||||
userWSClient, err := th.CreateWebSocketClient()
|
||||
|
||||
Ссылка в новой задаче
Block a user