Migrate CommandWebhook.Save to sync by default (#11595)

Этот коммит содержится в:
Rodrigo Villablanca Vásquez
2019-07-09 10:42:10 -04:00
коммит произвёл jfrerich
родитель ce61681c92
Коммит 25a2e7e981
5 изменённых файлов: 36 добавлений и 30 удалений

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

@@ -6,6 +6,8 @@ package storetest
import (
"testing"
"github.com/stretchr/testify/require"
"net/http"
"github.com/mattermost/mattermost-server/model"
@@ -23,7 +25,8 @@ func testCommandWebhookStore(t *testing.T, ss store.Store) {
h1.CommandId = model.NewId()
h1.UserId = model.NewId()
h1.ChannelId = model.NewId()
h1 = (<-cws.Save(h1)).Data.(*model.CommandWebhook)
h1, err := cws.Save(h1)
require.Nil(t, err)
if r1 := <-cws.Get(h1.Id); r1.Err != nil {
t.Fatal(r1.Err)
@@ -33,7 +36,7 @@ func testCommandWebhookStore(t *testing.T, ss store.Store) {
}
}
if err := (<-cws.Get("123")).Err; err.StatusCode != http.StatusNotFound {
if err = (<-cws.Get("123")).Err; err.StatusCode != http.StatusNotFound {
t.Fatal("Should have set the status as not found for missing id")
}
@@ -42,7 +45,8 @@ func testCommandWebhookStore(t *testing.T, ss store.Store) {
h2.CommandId = model.NewId()
h2.UserId = model.NewId()
h2.ChannelId = model.NewId()
h2 = (<-cws.Save(h2)).Data.(*model.CommandWebhook)
h2, err = cws.Save(h2)
require.Nil(t, err)
if err := (<-cws.Get(h2.Id)).Err; err == nil || err.StatusCode != http.StatusNotFound {
t.Fatal("Should have set the status as not found for expired webhook")