[MM-16512] Migrate Token.Save to Sync by default (#11353)

* [MM-16512] Migrate Token.Save to Sync by default

* refactor: formatting

* test: add checks for errors while saving tokens

* test: fixup
Этот коммит содержится в:
krjn
2019-06-26 10:36:41 +00:00
коммит произвёл Sudheer
родитель 2327ab8854
Коммит 72d482de0e
11 изменённых файлов: 42 добавлений и 44 удалений

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

@@ -93,7 +93,7 @@ func TestCreateUserWithToken(t *testing.T) {
app.TOKEN_TYPE_TEAM_INVITATION,
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": user.Email}),
)
<-th.App.Srv.Store.Token().Save(token)
require.Nil(t, th.App.Srv.Store.Token().Save(token))
ruser, resp := th.Client.CreateUserWithToken(&user, token.Token)
CheckNoError(t, resp)
@@ -124,7 +124,7 @@ func TestCreateUserWithToken(t *testing.T) {
app.TOKEN_TYPE_TEAM_INVITATION,
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": user.Email}),
)
<-th.App.Srv.Store.Token().Save(token)
require.Nil(t, th.App.Srv.Store.Token().Save(token))
defer th.App.DeleteToken(token)
_, resp := th.Client.CreateUserWithToken(&user, "")
@@ -141,7 +141,7 @@ func TestCreateUserWithToken(t *testing.T) {
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": user.Email}),
)
token.CreateAt = past49Hours
<-th.App.Srv.Store.Token().Save(token)
require.Nil(t, th.App.Srv.Store.Token().Save(token))
defer th.App.DeleteToken(token)
_, resp := th.Client.CreateUserWithToken(&user, token.Token)
@@ -170,7 +170,7 @@ func TestCreateUserWithToken(t *testing.T) {
app.TOKEN_TYPE_TEAM_INVITATION,
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": user.Email}),
)
<-th.App.Srv.Store.Token().Save(token)
require.Nil(t, th.App.Srv.Store.Token().Save(token))
defer th.App.DeleteToken(token)
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserCreation = false })
@@ -188,7 +188,7 @@ func TestCreateUserWithToken(t *testing.T) {
app.TOKEN_TYPE_TEAM_INVITATION,
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": user.Email}),
)
<-th.App.Srv.Store.Token().Save(token)
require.Nil(t, th.App.Srv.Store.Token().Save(token))
enableOpenServer := th.App.Config().TeamSettings.EnableOpenServer
defer func() {