[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
Этот коммит содержится в:
@@ -571,7 +571,7 @@ func TestCreateUserWithToken(t *testing.T) {
|
||||
TOKEN_TYPE_VERIFY_EMAIL,
|
||||
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)
|
||||
if _, err := th.App.CreateUserWithToken(&user, token.Token); err == nil {
|
||||
t.Fatal("Should fail on bad token type")
|
||||
@@ -584,7 +584,7 @@ func TestCreateUserWithToken(t *testing.T) {
|
||||
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": user.Email}),
|
||||
)
|
||||
token.CreateAt = model.GetMillis() - TEAM_INVITATION_EXPIRY_TIME - 1
|
||||
<-th.App.Srv.Store.Token().Save(token)
|
||||
require.Nil(t, th.App.Srv.Store.Token().Save(token))
|
||||
defer th.App.DeleteToken(token)
|
||||
if _, err := th.App.CreateUserWithToken(&user, token.Token); err == nil {
|
||||
t.Fatal("Should fail on expired token")
|
||||
@@ -596,7 +596,7 @@ func TestCreateUserWithToken(t *testing.T) {
|
||||
TOKEN_TYPE_TEAM_INVITATION,
|
||||
model.MapToJson(map[string]string{"teamId": model.NewId(), "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)
|
||||
if _, err := th.App.CreateUserWithToken(&user, token.Token); err == nil {
|
||||
t.Fatal("Should fail on bad team id")
|
||||
@@ -609,7 +609,7 @@ func TestCreateUserWithToken(t *testing.T) {
|
||||
TOKEN_TYPE_TEAM_INVITATION,
|
||||
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": invitationEmail}),
|
||||
)
|
||||
<-th.App.Srv.Store.Token().Save(token)
|
||||
require.Nil(t, th.App.Srv.Store.Token().Save(token))
|
||||
newUser, err := th.App.CreateUserWithToken(&user, token.Token)
|
||||
if err != nil {
|
||||
t.Log(err)
|
||||
|
||||
Ссылка в новой задаче
Block a user