[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
Этот коммит содержится в:
@@ -1436,7 +1436,7 @@ func TestAddTeamMember(t *testing.T) {
|
||||
app.TOKEN_TYPE_TEAM_INVITATION,
|
||||
model.MapToJson(map[string]string{"teamId": team.Id}),
|
||||
)
|
||||
<-th.App.Srv.Store.Token().Save(token)
|
||||
require.Nil(t, th.App.Srv.Store.Token().Save(token))
|
||||
|
||||
tm, resp = Client.AddTeamMemberFromInvite(token.Token, "")
|
||||
CheckNoError(t, resp)
|
||||
@@ -1466,7 +1466,7 @@ func TestAddTeamMember(t *testing.T) {
|
||||
// expired token of more than 50 hours
|
||||
token = model.NewToken(app.TOKEN_TYPE_TEAM_INVITATION, "")
|
||||
token.CreateAt = model.GetMillis() - 1000*60*60*50
|
||||
<-th.App.Srv.Store.Token().Save(token)
|
||||
require.Nil(t, th.App.Srv.Store.Token().Save(token))
|
||||
|
||||
_, resp = Client.AddTeamMemberFromInvite(token.Token, "")
|
||||
CheckBadRequestStatus(t, resp)
|
||||
@@ -1478,7 +1478,7 @@ func TestAddTeamMember(t *testing.T) {
|
||||
app.TOKEN_TYPE_TEAM_INVITATION,
|
||||
model.MapToJson(map[string]string{"teamId": testId}),
|
||||
)
|
||||
<-th.App.Srv.Store.Token().Save(token)
|
||||
require.Nil(t, th.App.Srv.Store.Token().Save(token))
|
||||
|
||||
_, resp = Client.AddTeamMemberFromInvite(token.Token, "")
|
||||
CheckNotFoundStatus(t, resp)
|
||||
@@ -1519,7 +1519,7 @@ func TestAddTeamMember(t *testing.T) {
|
||||
app.TOKEN_TYPE_TEAM_INVITATION,
|
||||
model.MapToJson(map[string]string{"teamId": team.Id}),
|
||||
)
|
||||
<-th.App.Srv.Store.Token().Save(token)
|
||||
require.Nil(t, th.App.Srv.Store.Token().Save(token))
|
||||
tm, resp = Client.AddTeamMemberFromInvite(token.Token, "")
|
||||
require.Equal(t, "app.team.invite_token.group_constrained.error", resp.Error.Id)
|
||||
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Ссылка в новой задаче
Block a user