[MM-41956] Unique name error on update (#19600)

* tools updates

* Revert "tools updates"

This reverts commit 6293297b55803c5a263e200ebd80192899666ae9.

* fixing error id for duplicate name on patch endpoint

* fixing broken test

Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MacBook-Pro.local>
Co-authored-by: Benjamin Cooke <benjamincooke@Benjamins-MBP.ht.home>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Ben Cooke
2022-03-07 16:15:41 -05:00
коммит произвёл GitHub
родитель 5dd4bec6fa
Коммит c82c826960
2 изменённых файлов: 2 добавлений и 2 удалений

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

@@ -328,7 +328,7 @@ func (s *SqlGroupStore) Update(group *model.Group) (*model.Group, error) {
WHERE Id=:Id`, group)
if err != nil {
if IsUniqueConstraintError(err, []string{"Name", "groups_name_key"}) {
return nil, errors.Wrapf(err, "Group with name %s already exists", *group.Name)
return nil, store.NewErrUniqueConstraint("Name")
}
return nil, errors.Wrap(err, "failed to update Group")
}

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

@@ -668,7 +668,7 @@ func testGroupStoreUpdate(t *testing.T, ss store.Store) {
RemoteId: model.NewString(model.NewId()),
})
require.Error(t, err)
require.Contains(t, err.Error(), fmt.Sprintf("Group with name %s already exists", *g1Update.Name))
require.Contains(t, err.Error(), "unique constraint: Name")
// Cannot update CreateAt
someVal := model.GetMillis()