Migrate Bots store to sync by default (#11182)

* Migrate Bots store to sync by default

* Fixing tests

* Fixing govet

* Fixing tests
Этот коммит содержится в:
Jesús Espino
2019-06-14 17:20:49 +02:00
коммит произвёл Christopher Speller
родитель 1c63057095
Коммит 693017a317
9 изменённых файлов: 419 добавлений и 395 удалений

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

@@ -512,9 +512,9 @@ func botToUser(command *cobra.Command, args []string, a *app.App) error {
}
}
result := <-a.Srv.Store.Bot().PermanentDelete(user.Id)
if result.Err != nil {
return fmt.Errorf("Unable to delete bot. Error: %s", result.Err.Error())
appErr = a.Srv.Store.Bot().PermanentDelete(user.Id)
if appErr != nil {
return fmt.Errorf("Unable to delete bot. Error: %s", appErr.Error())
}
CommandPrettyPrintln("id: " + user.Id)

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

@@ -132,8 +132,8 @@ func TestConvertUser(t *testing.T) {
t.Run("Convert to bot from username", func(t *testing.T) {
th.CheckCommand(t, "user", "convert", th.BasicUser.Username, "anotherinvaliduser", "--bot")
result := <-th.App.Srv.Store.Bot().Get(th.BasicUser.Id, false)
require.Nil(t, result.Err)
_, err := th.App.Srv.Store.Bot().Get(th.BasicUser.Id, false)
require.Nil(t, err)
})
t.Run("Unable to convert to user with missing password", func(t *testing.T) {
@@ -152,14 +152,14 @@ func TestConvertUser(t *testing.T) {
err := th.RunCommand(t, "user", "convert", th.BasicUser.Username, "--user",
"--password", "password")
require.Nil(t, err)
result := <-th.App.Srv.Store.Bot().Get(th.BasicUser.Id, false)
require.NotNil(t, result.Err)
_, err = th.App.Srv.Store.Bot().Get(th.BasicUser.Id, false)
require.NotNil(t, err)
})
t.Run("Convert to bot from email", func(t *testing.T) {
th.CheckCommand(t, "user", "convert", th.BasicUser2.Email, "--bot")
result := <-th.App.Srv.Store.Bot().Get(th.BasicUser2.Id, false)
require.Nil(t, result.Err)
_, err := th.App.Srv.Store.Bot().Get(th.BasicUser2.Id, false)
require.Nil(t, err)
})
t.Run("Convert to user with all flags", func(t *testing.T) {
@@ -174,8 +174,8 @@ func TestConvertUser(t *testing.T) {
"--system_admin")
require.Nil(t, err)
result := <-th.App.Srv.Store.Bot().Get(th.BasicUser2.Id, false)
require.NotNil(t, result.Err)
_, err = th.App.Srv.Store.Bot().Get(th.BasicUser2.Id, false)
require.NotNil(t, err)
user, appErr := th.App.Srv.Store.User().Get(th.BasicUser2.Id)
require.Nil(t, appErr)