MM-31063: Change constants to use CamelCase (#16608)
* MM-31063: Change constants to use CamelCase * store package * change allcaps to camel case (#16615) * New tools.mod Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
8b6ac5f5d2
Коммит
c1dd23a3c8
@@ -716,7 +716,7 @@ func TestCreateUserWithToken(t *testing.T) {
|
||||
|
||||
t.Run("invalid token type", func(t *testing.T) {
|
||||
token := model.NewToken(
|
||||
TOKEN_TYPE_VERIFY_EMAIL,
|
||||
TokenTypeVerifyEmail,
|
||||
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": user.Email}),
|
||||
)
|
||||
require.Nil(t, th.App.Srv().Store.Token().Save(token))
|
||||
@@ -727,10 +727,10 @@ func TestCreateUserWithToken(t *testing.T) {
|
||||
|
||||
t.Run("expired token", func(t *testing.T) {
|
||||
token := model.NewToken(
|
||||
TOKEN_TYPE_TEAM_INVITATION,
|
||||
TokenTypeTeamInvitation,
|
||||
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": user.Email}),
|
||||
)
|
||||
token.CreateAt = model.GetMillis() - INVITATION_EXPIRY_TIME - 1
|
||||
token.CreateAt = model.GetMillis() - InvitationExpiryTime - 1
|
||||
require.Nil(t, th.App.Srv().Store.Token().Save(token))
|
||||
defer th.App.DeleteToken(token)
|
||||
_, err := th.App.CreateUserWithToken(&user, token)
|
||||
@@ -739,7 +739,7 @@ func TestCreateUserWithToken(t *testing.T) {
|
||||
|
||||
t.Run("invalid team id", func(t *testing.T) {
|
||||
token := model.NewToken(
|
||||
TOKEN_TYPE_TEAM_INVITATION,
|
||||
TokenTypeTeamInvitation,
|
||||
model.MapToJson(map[string]string{"teamId": model.NewId(), "email": user.Email}),
|
||||
)
|
||||
require.Nil(t, th.App.Srv().Store.Token().Save(token))
|
||||
@@ -751,7 +751,7 @@ func TestCreateUserWithToken(t *testing.T) {
|
||||
t.Run("valid regular user request", func(t *testing.T) {
|
||||
invitationEmail := model.NewId() + "other-email@test.com"
|
||||
token := model.NewToken(
|
||||
TOKEN_TYPE_TEAM_INVITATION,
|
||||
TokenTypeTeamInvitation,
|
||||
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": invitationEmail}),
|
||||
)
|
||||
require.Nil(t, th.App.Srv().Store.Token().Save(token))
|
||||
@@ -771,7 +771,7 @@ func TestCreateUserWithToken(t *testing.T) {
|
||||
t.Run("valid guest request", func(t *testing.T) {
|
||||
invitationEmail := model.NewId() + "other-email@test.com"
|
||||
token := model.NewToken(
|
||||
TOKEN_TYPE_GUEST_INVITATION,
|
||||
TokenTypeGuestInvitation,
|
||||
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": invitationEmail, "channels": th.BasicChannel.Id}),
|
||||
)
|
||||
require.Nil(t, th.App.Srv().Store.Token().Save(token))
|
||||
@@ -801,11 +801,11 @@ func TestCreateUserWithToken(t *testing.T) {
|
||||
forbiddenInvitationEmail := model.NewId() + "other-email@test.com"
|
||||
grantedInvitationEmail := model.NewId() + "other-email@restricted.com"
|
||||
forbiddenDomainToken := model.NewToken(
|
||||
TOKEN_TYPE_GUEST_INVITATION,
|
||||
TokenTypeGuestInvitation,
|
||||
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": forbiddenInvitationEmail, "channels": th.BasicChannel.Id}),
|
||||
)
|
||||
grantedDomainToken := model.NewToken(
|
||||
TOKEN_TYPE_GUEST_INVITATION,
|
||||
TokenTypeGuestInvitation,
|
||||
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": grantedInvitationEmail, "channels": th.BasicChannel.Id}),
|
||||
)
|
||||
require.Nil(t, th.App.Srv().Store.Token().Save(forbiddenDomainToken))
|
||||
@@ -848,7 +848,7 @@ func TestCreateUserWithToken(t *testing.T) {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.RestrictCreationToDomains = "restricted.com" })
|
||||
invitationEmail := model.NewId() + "other-email@test.com"
|
||||
token := model.NewToken(
|
||||
TOKEN_TYPE_GUEST_INVITATION,
|
||||
TokenTypeGuestInvitation,
|
||||
model.MapToJson(map[string]string{"teamId": th.BasicTeam.Id, "email": invitationEmail, "channels": th.BasicChannel.Id}),
|
||||
)
|
||||
require.Nil(t, th.App.Srv().Store.Token().Save(token))
|
||||
|
||||
Ссылка в новой задаче
Block a user