Prevent User.Timezone field to overflow DB column capacity (#17220)

Этот коммит содержится в:
Claudio Costa
2021-03-25 11:38:43 +01:00
коммит произвёл GitHub
родитель 58069ff7dc
Коммит 28df047d92
3 изменённых файлов: 23 добавлений и 0 удалений

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

@@ -1693,6 +1693,16 @@ func TestPatchUser(t *testing.T) {
user := th.CreateUser()
th.Client.Login(user.Email, user.Password)
t.Run("Timezone limit error", func(t *testing.T) {
patch := &model.UserPatch{}
patch.Timezone = model.StringMap{}
patch.Timezone["manualTimezone"] = string(make([]byte, model.USER_TIMEZONE_MAX_RUNES))
ruser, resp := th.Client.PatchUser(user.Id, patch)
CheckBadRequestStatus(t, resp)
require.Equal(t, "model.user.is_valid.timezone_limit.app_error", resp.Error.Id)
require.Nil(t, ruser)
})
patch := &model.UserPatch{}
patch.Password = model.NewString("testpassword")
patch.Nickname = model.NewString("Joram Wilander")