mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Run gofmt -s against codebase (#12943)
This commit is contained in:
@@ -5,6 +5,8 @@ run:
|
|||||||
linters-settings:
|
linters-settings:
|
||||||
govet:
|
govet:
|
||||||
check-shadowing: true
|
check-shadowing: true
|
||||||
|
gofmt:
|
||||||
|
simplify: true
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ func TestOpenDialog(t *testing.T) {
|
|||||||
CallbackId: "callbackid",
|
CallbackId: "callbackid",
|
||||||
Title: "Some Title",
|
Title: "Some Title",
|
||||||
Elements: []model.DialogElement{
|
Elements: []model.DialogElement{
|
||||||
model.DialogElement{
|
{
|
||||||
DisplayName: "Element Name",
|
DisplayName: "Element Name",
|
||||||
Name: "element_name",
|
Name: "element_name",
|
||||||
Type: "text",
|
Type: "text",
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ func TestDisableOnRemove(t *testing.T) {
|
|||||||
pluginsResp, resp := th.SystemAdminClient.GetPlugins()
|
pluginsResp, resp := th.SystemAdminClient.GetPlugins()
|
||||||
CheckNoError(t, resp)
|
CheckNoError(t, resp)
|
||||||
require.Len(t, pluginsResp.Active, 0)
|
require.Len(t, pluginsResp.Active, 0)
|
||||||
require.Equal(t, pluginsResp.Inactive, []*model.PluginInfo{&model.PluginInfo{
|
require.Equal(t, pluginsResp.Inactive, []*model.PluginInfo{{
|
||||||
Manifest: *manifest,
|
Manifest: *manifest,
|
||||||
}})
|
}})
|
||||||
|
|
||||||
@@ -400,7 +400,7 @@ func TestDisableOnRemove(t *testing.T) {
|
|||||||
pluginsResp, resp = th.SystemAdminClient.GetPlugins()
|
pluginsResp, resp = th.SystemAdminClient.GetPlugins()
|
||||||
CheckNoError(t, resp)
|
CheckNoError(t, resp)
|
||||||
require.Len(t, pluginsResp.Inactive, 0)
|
require.Len(t, pluginsResp.Inactive, 0)
|
||||||
require.Equal(t, pluginsResp.Active, []*model.PluginInfo{&model.PluginInfo{
|
require.Equal(t, pluginsResp.Active, []*model.PluginInfo{{
|
||||||
Manifest: *manifest,
|
Manifest: *manifest,
|
||||||
}})
|
}})
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ func TestDisableOnRemove(t *testing.T) {
|
|||||||
pluginsResp, resp = th.SystemAdminClient.GetPlugins()
|
pluginsResp, resp = th.SystemAdminClient.GetPlugins()
|
||||||
CheckNoError(t, resp)
|
CheckNoError(t, resp)
|
||||||
require.Len(t, pluginsResp.Inactive, 0)
|
require.Len(t, pluginsResp.Inactive, 0)
|
||||||
require.Equal(t, pluginsResp.Active, []*model.PluginInfo{&model.PluginInfo{
|
require.Equal(t, pluginsResp.Active, []*model.PluginInfo{{
|
||||||
Manifest: *manifest,
|
Manifest: *manifest,
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
@@ -439,7 +439,7 @@ func TestDisableOnRemove(t *testing.T) {
|
|||||||
pluginsResp, resp = th.SystemAdminClient.GetPlugins()
|
pluginsResp, resp = th.SystemAdminClient.GetPlugins()
|
||||||
CheckNoError(t, resp)
|
CheckNoError(t, resp)
|
||||||
require.Len(t, pluginsResp.Active, 0)
|
require.Len(t, pluginsResp.Active, 0)
|
||||||
require.Equal(t, pluginsResp.Inactive, []*model.PluginInfo{&model.PluginInfo{
|
require.Equal(t, pluginsResp.Inactive, []*model.PluginInfo{{
|
||||||
Manifest: *manifest,
|
Manifest: *manifest,
|
||||||
}})
|
}})
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ func TestWebSocket(t *testing.T) {
|
|||||||
WebSocketClient.SendMessage("ping", nil)
|
WebSocketClient.SendMessage("ping", nil)
|
||||||
time.Sleep(300 * time.Millisecond)
|
time.Sleep(300 * time.Millisecond)
|
||||||
resp = <-WebSocketClient.ResponseChannel
|
resp = <-WebSocketClient.ResponseChannel
|
||||||
require.Equal(t, resp.Data["text"].(string),"pong","wrong response")
|
require.Equal(t, resp.Data["text"].(string), "pong", "wrong response")
|
||||||
|
|
||||||
WebSocketClient.SendMessage("", nil)
|
WebSocketClient.SendMessage("", nil)
|
||||||
time.Sleep(300 * time.Millisecond)
|
time.Sleep(300 * time.Millisecond)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
|||||||
assert.Equal(t, len(roles1), len(roleNames))
|
assert.Equal(t, len(roles1), len(roleNames))
|
||||||
|
|
||||||
expected1 := map[string][]string{
|
expected1 := map[string][]string{
|
||||||
"channel_user": []string{
|
"channel_user": {
|
||||||
model.PERMISSION_READ_CHANNEL.Id,
|
model.PERMISSION_READ_CHANNEL.Id,
|
||||||
model.PERMISSION_ADD_REACTION.Id,
|
model.PERMISSION_ADD_REACTION.Id,
|
||||||
model.PERMISSION_REMOVE_REACTION.Id,
|
model.PERMISSION_REMOVE_REACTION.Id,
|
||||||
@@ -86,10 +86,10 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
|||||||
model.PERMISSION_DELETE_POST.Id,
|
model.PERMISSION_DELETE_POST.Id,
|
||||||
model.PERMISSION_EDIT_POST.Id,
|
model.PERMISSION_EDIT_POST.Id,
|
||||||
},
|
},
|
||||||
"channel_admin": []string{
|
"channel_admin": {
|
||||||
model.PERMISSION_MANAGE_CHANNEL_ROLES.Id,
|
model.PERMISSION_MANAGE_CHANNEL_ROLES.Id,
|
||||||
},
|
},
|
||||||
"team_user": []string{
|
"team_user": {
|
||||||
model.PERMISSION_LIST_TEAM_CHANNELS.Id,
|
model.PERMISSION_LIST_TEAM_CHANNELS.Id,
|
||||||
model.PERMISSION_JOIN_PUBLIC_CHANNELS.Id,
|
model.PERMISSION_JOIN_PUBLIC_CHANNELS.Id,
|
||||||
model.PERMISSION_READ_PUBLIC_CHANNEL.Id,
|
model.PERMISSION_READ_PUBLIC_CHANNEL.Id,
|
||||||
@@ -99,13 +99,13 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
|||||||
model.PERMISSION_INVITE_USER.Id,
|
model.PERMISSION_INVITE_USER.Id,
|
||||||
model.PERMISSION_ADD_USER_TO_TEAM.Id,
|
model.PERMISSION_ADD_USER_TO_TEAM.Id,
|
||||||
},
|
},
|
||||||
"team_post_all": []string{
|
"team_post_all": {
|
||||||
model.PERMISSION_CREATE_POST.Id,
|
model.PERMISSION_CREATE_POST.Id,
|
||||||
},
|
},
|
||||||
"team_post_all_public": []string{
|
"team_post_all_public": {
|
||||||
model.PERMISSION_CREATE_POST_PUBLIC.Id,
|
model.PERMISSION_CREATE_POST_PUBLIC.Id,
|
||||||
},
|
},
|
||||||
"team_admin": []string{
|
"team_admin": {
|
||||||
model.PERMISSION_REMOVE_USER_FROM_TEAM.Id,
|
model.PERMISSION_REMOVE_USER_FROM_TEAM.Id,
|
||||||
model.PERMISSION_MANAGE_TEAM.Id,
|
model.PERMISSION_MANAGE_TEAM.Id,
|
||||||
model.PERMISSION_IMPORT_TEAM.Id,
|
model.PERMISSION_IMPORT_TEAM.Id,
|
||||||
@@ -120,7 +120,7 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
|||||||
model.PERMISSION_DELETE_POST.Id,
|
model.PERMISSION_DELETE_POST.Id,
|
||||||
model.PERMISSION_DELETE_OTHERS_POSTS.Id,
|
model.PERMISSION_DELETE_OTHERS_POSTS.Id,
|
||||||
},
|
},
|
||||||
"system_user": []string{
|
"system_user": {
|
||||||
model.PERMISSION_LIST_PUBLIC_TEAMS.Id,
|
model.PERMISSION_LIST_PUBLIC_TEAMS.Id,
|
||||||
model.PERMISSION_JOIN_PUBLIC_TEAMS.Id,
|
model.PERMISSION_JOIN_PUBLIC_TEAMS.Id,
|
||||||
model.PERMISSION_CREATE_DIRECT_CHANNEL.Id,
|
model.PERMISSION_CREATE_DIRECT_CHANNEL.Id,
|
||||||
@@ -128,18 +128,18 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
|||||||
model.PERMISSION_VIEW_MEMBERS.Id,
|
model.PERMISSION_VIEW_MEMBERS.Id,
|
||||||
model.PERMISSION_CREATE_TEAM.Id,
|
model.PERMISSION_CREATE_TEAM.Id,
|
||||||
},
|
},
|
||||||
"system_post_all": []string{
|
"system_post_all": {
|
||||||
model.PERMISSION_CREATE_POST.Id,
|
model.PERMISSION_CREATE_POST.Id,
|
||||||
},
|
},
|
||||||
"system_post_all_public": []string{
|
"system_post_all_public": {
|
||||||
model.PERMISSION_CREATE_POST_PUBLIC.Id,
|
model.PERMISSION_CREATE_POST_PUBLIC.Id,
|
||||||
},
|
},
|
||||||
"system_user_access_token": []string{
|
"system_user_access_token": {
|
||||||
model.PERMISSION_CREATE_USER_ACCESS_TOKEN.Id,
|
model.PERMISSION_CREATE_USER_ACCESS_TOKEN.Id,
|
||||||
model.PERMISSION_READ_USER_ACCESS_TOKEN.Id,
|
model.PERMISSION_READ_USER_ACCESS_TOKEN.Id,
|
||||||
model.PERMISSION_REVOKE_USER_ACCESS_TOKEN.Id,
|
model.PERMISSION_REVOKE_USER_ACCESS_TOKEN.Id,
|
||||||
},
|
},
|
||||||
"system_admin": []string{
|
"system_admin": {
|
||||||
model.PERMISSION_ASSIGN_SYSTEM_ADMIN_ROLE.Id,
|
model.PERMISSION_ASSIGN_SYSTEM_ADMIN_ROLE.Id,
|
||||||
model.PERMISSION_MANAGE_SYSTEM.Id,
|
model.PERMISSION_MANAGE_SYSTEM.Id,
|
||||||
model.PERMISSION_MANAGE_ROLES.Id,
|
model.PERMISSION_MANAGE_ROLES.Id,
|
||||||
@@ -254,7 +254,7 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
|||||||
|
|
||||||
// Check the role permissions.
|
// Check the role permissions.
|
||||||
expected2 := map[string][]string{
|
expected2 := map[string][]string{
|
||||||
"channel_user": []string{
|
"channel_user": {
|
||||||
model.PERMISSION_READ_CHANNEL.Id,
|
model.PERMISSION_READ_CHANNEL.Id,
|
||||||
model.PERMISSION_ADD_REACTION.Id,
|
model.PERMISSION_ADD_REACTION.Id,
|
||||||
model.PERMISSION_REMOVE_REACTION.Id,
|
model.PERMISSION_REMOVE_REACTION.Id,
|
||||||
@@ -269,10 +269,10 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
|||||||
model.PERMISSION_DELETE_POST.Id,
|
model.PERMISSION_DELETE_POST.Id,
|
||||||
model.PERMISSION_EDIT_POST.Id,
|
model.PERMISSION_EDIT_POST.Id,
|
||||||
},
|
},
|
||||||
"channel_admin": []string{
|
"channel_admin": {
|
||||||
model.PERMISSION_MANAGE_CHANNEL_ROLES.Id,
|
model.PERMISSION_MANAGE_CHANNEL_ROLES.Id,
|
||||||
},
|
},
|
||||||
"team_user": []string{
|
"team_user": {
|
||||||
model.PERMISSION_LIST_TEAM_CHANNELS.Id,
|
model.PERMISSION_LIST_TEAM_CHANNELS.Id,
|
||||||
model.PERMISSION_JOIN_PUBLIC_CHANNELS.Id,
|
model.PERMISSION_JOIN_PUBLIC_CHANNELS.Id,
|
||||||
model.PERMISSION_READ_PUBLIC_CHANNEL.Id,
|
model.PERMISSION_READ_PUBLIC_CHANNEL.Id,
|
||||||
@@ -282,13 +282,13 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
|||||||
model.PERMISSION_INVITE_USER.Id,
|
model.PERMISSION_INVITE_USER.Id,
|
||||||
model.PERMISSION_ADD_USER_TO_TEAM.Id,
|
model.PERMISSION_ADD_USER_TO_TEAM.Id,
|
||||||
},
|
},
|
||||||
"team_post_all": []string{
|
"team_post_all": {
|
||||||
model.PERMISSION_CREATE_POST.Id,
|
model.PERMISSION_CREATE_POST.Id,
|
||||||
},
|
},
|
||||||
"team_post_all_public": []string{
|
"team_post_all_public": {
|
||||||
model.PERMISSION_CREATE_POST_PUBLIC.Id,
|
model.PERMISSION_CREATE_POST_PUBLIC.Id,
|
||||||
},
|
},
|
||||||
"team_admin": []string{
|
"team_admin": {
|
||||||
model.PERMISSION_REMOVE_USER_FROM_TEAM.Id,
|
model.PERMISSION_REMOVE_USER_FROM_TEAM.Id,
|
||||||
model.PERMISSION_MANAGE_TEAM.Id,
|
model.PERMISSION_MANAGE_TEAM.Id,
|
||||||
model.PERMISSION_IMPORT_TEAM.Id,
|
model.PERMISSION_IMPORT_TEAM.Id,
|
||||||
@@ -305,7 +305,7 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
|||||||
model.PERMISSION_DELETE_POST.Id,
|
model.PERMISSION_DELETE_POST.Id,
|
||||||
model.PERMISSION_DELETE_OTHERS_POSTS.Id,
|
model.PERMISSION_DELETE_OTHERS_POSTS.Id,
|
||||||
},
|
},
|
||||||
"system_user": []string{
|
"system_user": {
|
||||||
model.PERMISSION_LIST_PUBLIC_TEAMS.Id,
|
model.PERMISSION_LIST_PUBLIC_TEAMS.Id,
|
||||||
model.PERMISSION_JOIN_PUBLIC_TEAMS.Id,
|
model.PERMISSION_JOIN_PUBLIC_TEAMS.Id,
|
||||||
model.PERMISSION_CREATE_DIRECT_CHANNEL.Id,
|
model.PERMISSION_CREATE_DIRECT_CHANNEL.Id,
|
||||||
@@ -313,18 +313,18 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
|||||||
model.PERMISSION_VIEW_MEMBERS.Id,
|
model.PERMISSION_VIEW_MEMBERS.Id,
|
||||||
model.PERMISSION_CREATE_TEAM.Id,
|
model.PERMISSION_CREATE_TEAM.Id,
|
||||||
},
|
},
|
||||||
"system_post_all": []string{
|
"system_post_all": {
|
||||||
model.PERMISSION_CREATE_POST.Id,
|
model.PERMISSION_CREATE_POST.Id,
|
||||||
},
|
},
|
||||||
"system_post_all_public": []string{
|
"system_post_all_public": {
|
||||||
model.PERMISSION_CREATE_POST_PUBLIC.Id,
|
model.PERMISSION_CREATE_POST_PUBLIC.Id,
|
||||||
},
|
},
|
||||||
"system_user_access_token": []string{
|
"system_user_access_token": {
|
||||||
model.PERMISSION_CREATE_USER_ACCESS_TOKEN.Id,
|
model.PERMISSION_CREATE_USER_ACCESS_TOKEN.Id,
|
||||||
model.PERMISSION_READ_USER_ACCESS_TOKEN.Id,
|
model.PERMISSION_READ_USER_ACCESS_TOKEN.Id,
|
||||||
model.PERMISSION_REVOKE_USER_ACCESS_TOKEN.Id,
|
model.PERMISSION_REVOKE_USER_ACCESS_TOKEN.Id,
|
||||||
},
|
},
|
||||||
"system_admin": []string{
|
"system_admin": {
|
||||||
model.PERMISSION_ASSIGN_SYSTEM_ADMIN_ROLE.Id,
|
model.PERMISSION_ASSIGN_SYSTEM_ADMIN_ROLE.Id,
|
||||||
model.PERMISSION_MANAGE_SYSTEM.Id,
|
model.PERMISSION_MANAGE_SYSTEM.Id,
|
||||||
model.PERMISSION_MANAGE_ROLES.Id,
|
model.PERMISSION_MANAGE_ROLES.Id,
|
||||||
|
|||||||
@@ -189,7 +189,7 @@ func TestHandleCommandResponsePost(t *testing.T) {
|
|||||||
|
|
||||||
// Test Slack attachments text conversion.
|
// Test Slack attachments text conversion.
|
||||||
resp.Attachments = []*model.SlackAttachment{
|
resp.Attachments = []*model.SlackAttachment{
|
||||||
&model.SlackAttachment{
|
{
|
||||||
Text: "<!here>",
|
Text: "<!here>",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -212,7 +212,7 @@ func TestHandleCommandResponsePost(t *testing.T) {
|
|||||||
resp.ChannelId = ""
|
resp.ChannelId = ""
|
||||||
resp.Text = "<test.com|test website>"
|
resp.Text = "<test.com|test website>"
|
||||||
resp.Attachments = []*model.SlackAttachment{
|
resp.Attachments = []*model.SlackAttachment{
|
||||||
&model.SlackAttachment{
|
{
|
||||||
Text: "<!here>",
|
Text: "<!here>",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -257,10 +257,10 @@ func TestHandleCommandResponse(t *testing.T) {
|
|||||||
resp = &model.CommandResponse{
|
resp = &model.CommandResponse{
|
||||||
Text: "message 1",
|
Text: "message 1",
|
||||||
ExtraResponses: []*model.CommandResponse{
|
ExtraResponses: []*model.CommandResponse{
|
||||||
&model.CommandResponse{
|
{
|
||||||
Text: "message 2",
|
Text: "message 2",
|
||||||
},
|
},
|
||||||
&model.CommandResponse{
|
{
|
||||||
Type: model.POST_SYSTEM_GENERIC,
|
Type: model.POST_SYSTEM_GENERIC,
|
||||||
Text: "message 3",
|
Text: "message 3",
|
||||||
},
|
},
|
||||||
@@ -274,8 +274,8 @@ func TestHandleCommandResponse(t *testing.T) {
|
|||||||
|
|
||||||
resp = &model.CommandResponse{
|
resp = &model.CommandResponse{
|
||||||
ExtraResponses: []*model.CommandResponse{
|
ExtraResponses: []*model.CommandResponse{
|
||||||
&model.CommandResponse{},
|
{},
|
||||||
&model.CommandResponse{},
|
{},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import (
|
|||||||
func TestPluginSetting(t *testing.T) {
|
func TestPluginSetting(t *testing.T) {
|
||||||
settings := &model.PluginSettings{
|
settings := &model.PluginSettings{
|
||||||
Plugins: map[string]map[string]interface{}{
|
Plugins: map[string]map[string]interface{}{
|
||||||
"test": map[string]interface{}{
|
"test": {
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -31,10 +31,10 @@ func TestPluginSetting(t *testing.T) {
|
|||||||
|
|
||||||
func TestPluginActivated(t *testing.T) {
|
func TestPluginActivated(t *testing.T) {
|
||||||
states := map[string]*model.PluginState{
|
states := map[string]*model.PluginState{
|
||||||
"foo": &model.PluginState{
|
"foo": {
|
||||||
Enable: true,
|
Enable: true,
|
||||||
},
|
},
|
||||||
"bar": &model.PluginState{
|
"bar": {
|
||||||
Enable: false,
|
Enable: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,11 +64,11 @@ func TestHandleNewNotifications(t *testing.T) {
|
|||||||
job.Add(&model.User{Id: id1}, &model.Post{UserId: id1, Message: "test4"}, &model.Team{Name: "team"})
|
job.Add(&model.User{Id: id1}, &model.Post{UserId: id1, Message: "test4"}, &model.Team{Name: "team"})
|
||||||
job.Add(&model.User{Id: id2}, &model.Post{UserId: id1, Message: "test5"}, &model.Team{Name: "team"})
|
job.Add(&model.User{Id: id2}, &model.Post{UserId: id1, Message: "test5"}, &model.Team{Name: "team"})
|
||||||
job.handleNewNotifications()
|
job.handleNewNotifications()
|
||||||
assert.Equal(t, job.pendingNotifications[id1][0].post.Message, "test1", "incorrect order of received posts for user1");
|
assert.Equal(t, job.pendingNotifications[id1][0].post.Message, "test1", "incorrect order of received posts for user1")
|
||||||
assert.Equal(t, job.pendingNotifications[id1][1].post.Message, "test2", "incorrect order of received posts for user1");
|
assert.Equal(t, job.pendingNotifications[id1][1].post.Message, "test2", "incorrect order of received posts for user1")
|
||||||
assert.Equal(t, job.pendingNotifications[id1][2].post.Message, "test4", "incorrect order of received posts for user1");
|
assert.Equal(t, job.pendingNotifications[id1][2].post.Message, "test4", "incorrect order of received posts for user1")
|
||||||
assert.Equal(t, job.pendingNotifications[id2][0].post.Message, "test3", "incorrect order of received posts for user2");
|
assert.Equal(t, job.pendingNotifications[id2][0].post.Message, "test3", "incorrect order of received posts for user2")
|
||||||
assert.Equal(t, job.pendingNotifications[id2][1].post.Message, "test5", "incorrect order of received posts for user2");
|
assert.Equal(t, job.pendingNotifications[id2][1].post.Message, "test5", "incorrect order of received posts for user2")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCheckPendingNotifications(t *testing.T) {
|
func TestCheckPendingNotifications(t *testing.T) {
|
||||||
|
|||||||
@@ -487,7 +487,7 @@ func TestImportValidateUserImportData(t *testing.T) {
|
|||||||
|
|
||||||
data.Username = ptrStr("i am a username with spaces and !!!")
|
data.Username = ptrStr("i am a username with spaces and !!!")
|
||||||
err = validateUserImportData(&data)
|
err = validateUserImportData(&data)
|
||||||
require.NotNil(t, err, "Validation should have failed due to invalid characters in Username.");
|
require.NotNil(t, err, "Validation should have failed due to invalid characters in Username.")
|
||||||
|
|
||||||
data.Username = ptrStr("bob")
|
data.Username = ptrStr("bob")
|
||||||
|
|
||||||
@@ -759,7 +759,6 @@ func TestImportValidateReactionImportData(t *testing.T) {
|
|||||||
err = validateReactionImportData(&data, parentCreateAt)
|
err = validateReactionImportData(&data, parentCreateAt)
|
||||||
require.NotNil(t, err, "Should have failed due to missing required property.")
|
require.NotNil(t, err, "Should have failed due to missing required property.")
|
||||||
|
|
||||||
|
|
||||||
data = ReactionImportData{
|
data = ReactionImportData{
|
||||||
User: ptrStr("username"),
|
User: ptrStr("username"),
|
||||||
EmojiName: ptrStr("emoji"),
|
EmojiName: ptrStr("emoji"),
|
||||||
@@ -938,13 +937,13 @@ func TestImportValidatePostImportData(t *testing.T) {
|
|||||||
require.NotNil(t, err, "Should have failed due to 0 create-at value.")
|
require.NotNil(t, err, "Should have failed due to 0 create-at value.")
|
||||||
|
|
||||||
// Test with valid all optional parameters.
|
// Test with valid all optional parameters.
|
||||||
reactions := []ReactionImportData{ReactionImportData{
|
reactions := []ReactionImportData{{
|
||||||
User: ptrStr("username"),
|
User: ptrStr("username"),
|
||||||
EmojiName: ptrStr("emoji"),
|
EmojiName: ptrStr("emoji"),
|
||||||
CreateAt: ptrInt64(model.GetMillis()),
|
CreateAt: ptrInt64(model.GetMillis()),
|
||||||
}}
|
}}
|
||||||
|
|
||||||
replies := []ReplyImportData{ReplyImportData{
|
replies := []ReplyImportData{{
|
||||||
User: ptrStr("username"),
|
User: ptrStr("username"),
|
||||||
Message: ptrStr("message"),
|
Message: ptrStr("message"),
|
||||||
CreateAt: ptrInt64(model.GetMillis()),
|
CreateAt: ptrInt64(model.GetMillis()),
|
||||||
@@ -1240,13 +1239,13 @@ func TestImportValidateDirectPostImportData(t *testing.T) {
|
|||||||
require.Nil(t, err, "Validation should succeed with post flagged by members")
|
require.Nil(t, err, "Validation should succeed with post flagged by members")
|
||||||
|
|
||||||
// Test with valid all optional parameters.
|
// Test with valid all optional parameters.
|
||||||
reactions := []ReactionImportData{ReactionImportData{
|
reactions := []ReactionImportData{{
|
||||||
User: ptrStr("username"),
|
User: ptrStr("username"),
|
||||||
EmojiName: ptrStr("emoji"),
|
EmojiName: ptrStr("emoji"),
|
||||||
CreateAt: ptrInt64(model.GetMillis()),
|
CreateAt: ptrInt64(model.GetMillis()),
|
||||||
}}
|
}}
|
||||||
|
|
||||||
replies := []ReplyImportData{ReplyImportData{
|
replies := []ReplyImportData{{
|
||||||
User: ptrStr("username"),
|
User: ptrStr("username"),
|
||||||
Message: ptrStr("message"),
|
Message: ptrStr("message"),
|
||||||
CreateAt: ptrInt64(model.GetMillis()),
|
CreateAt: ptrInt64(model.GetMillis()),
|
||||||
|
|||||||
@@ -430,7 +430,7 @@ func TestSubmitInteractiveDialog(t *testing.T) {
|
|||||||
assert.Equal(t, "value1", val)
|
assert.Equal(t, "value1", val)
|
||||||
|
|
||||||
resp := model.SubmitDialogResponse{
|
resp := model.SubmitDialogResponse{
|
||||||
Error: "some generic error",
|
Error: "some generic error",
|
||||||
Errors: map[string]string{"name1": "some error"},
|
Errors: map[string]string{"name1": "some error"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -571,7 +571,7 @@ func TestHookFileWillBeUploaded(t *testing.T) {
|
|||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
assert.NotNil(t, response)
|
assert.NotNil(t, response)
|
||||||
assert.Equal(t, 1, len(response.FileInfos))
|
assert.Equal(t, 1, len(response.FileInfos))
|
||||||
|
|
||||||
fileId := response.FileInfos[0].Id
|
fileId := response.FileInfos[0].Id
|
||||||
fileInfo, err := th.App.GetFileInfo(fileId)
|
fileInfo, err := th.App.GetFileInfo(fileId)
|
||||||
assert.Nil(t, err)
|
assert.Nil(t, err)
|
||||||
|
|||||||
@@ -389,13 +389,13 @@ func TestSplitWebhookPost(t *testing.T) {
|
|||||||
Message: strings.Repeat("本", maxPostSize*3/2),
|
Message: strings.Repeat("本", maxPostSize*3/2),
|
||||||
Props: map[string]interface{}{
|
Props: map[string]interface{}{
|
||||||
"attachments": []*model.SlackAttachment{
|
"attachments": []*model.SlackAttachment{
|
||||||
&model.SlackAttachment{
|
{
|
||||||
Text: strings.Repeat("本", 1000),
|
Text: strings.Repeat("本", 1000),
|
||||||
},
|
},
|
||||||
&model.SlackAttachment{
|
{
|
||||||
Text: strings.Repeat("本", 2000),
|
Text: strings.Repeat("本", 2000),
|
||||||
},
|
},
|
||||||
&model.SlackAttachment{
|
{
|
||||||
Text: strings.Repeat("本", model.POST_PROPS_MAX_USER_RUNES-1000),
|
Text: strings.Repeat("本", model.POST_PROPS_MAX_USER_RUNES-1000),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -409,10 +409,10 @@ func TestSplitWebhookPost(t *testing.T) {
|
|||||||
Message: strings.Repeat("本", maxPostSize/2),
|
Message: strings.Repeat("本", maxPostSize/2),
|
||||||
Props: map[string]interface{}{
|
Props: map[string]interface{}{
|
||||||
"attachments": []*model.SlackAttachment{
|
"attachments": []*model.SlackAttachment{
|
||||||
&model.SlackAttachment{
|
{
|
||||||
Text: strings.Repeat("本", 1000),
|
Text: strings.Repeat("本", 1000),
|
||||||
},
|
},
|
||||||
&model.SlackAttachment{
|
{
|
||||||
Text: strings.Repeat("本", 2000),
|
Text: strings.Repeat("本", 2000),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -421,7 +421,7 @@ func TestSplitWebhookPost(t *testing.T) {
|
|||||||
{
|
{
|
||||||
Props: map[string]interface{}{
|
Props: map[string]interface{}{
|
||||||
"attachments": []*model.SlackAttachment{
|
"attachments": []*model.SlackAttachment{
|
||||||
&model.SlackAttachment{
|
{
|
||||||
Text: strings.Repeat("本", model.POST_PROPS_MAX_USER_RUNES-1000),
|
Text: strings.Repeat("本", model.POST_PROPS_MAX_USER_RUNES-1000),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ func TestChangeUserEmail(t *testing.T) {
|
|||||||
|
|
||||||
require.Equal(t, user.Email, newEmail, "should've updated to the new email")
|
require.Equal(t, user.Email, newEmail, "should've updated to the new email")
|
||||||
|
|
||||||
|
|
||||||
// should fail because using an invalid email
|
// should fail because using an invalid email
|
||||||
require.Error(t, th.RunCommand(t, "user", "email", th.BasicUser.Username, "wrong$email.com"))
|
require.Error(t, th.RunCommand(t, "user", "email", th.BasicUser.Username, "wrong$email.com"))
|
||||||
|
|
||||||
|
|||||||
@@ -764,7 +764,7 @@ func TestDatabaseStoreLoad(t *testing.T) {
|
|||||||
|
|
||||||
func TestDatabaseGetFile(t *testing.T) {
|
func TestDatabaseGetFile(t *testing.T) {
|
||||||
_, tearDown := setupConfigDatabase(t, minimalConfig, map[string][]byte{
|
_, tearDown := setupConfigDatabase(t, minimalConfig, map[string][]byte{
|
||||||
"empty-file": []byte{},
|
"empty-file": {},
|
||||||
"test-file": []byte("test"),
|
"test-file": []byte("test"),
|
||||||
})
|
})
|
||||||
defer tearDown()
|
defer tearDown()
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ func TestMemoryGetFile(t *testing.T) {
|
|||||||
ms, err := config.NewMemoryStoreWithOptions(&config.MemoryStoreOptions{
|
ms, err := config.NewMemoryStoreWithOptions(&config.MemoryStoreOptions{
|
||||||
InitialConfig: minimalConfig,
|
InitialConfig: minimalConfig,
|
||||||
InitialFiles: map[string][]byte{
|
InitialFiles: map[string][]byte{
|
||||||
"empty-file": []byte{},
|
"empty-file": {},
|
||||||
"test-file": []byte("test"),
|
"test-file": []byte("test"),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ func TestClient4CreatePost(t *testing.T) {
|
|||||||
post := &Post{
|
post := &Post{
|
||||||
Props: map[string]interface{}{
|
Props: map[string]interface{}{
|
||||||
"attachments": []*SlackAttachment{
|
"attachments": []*SlackAttachment{
|
||||||
&SlackAttachment{
|
{
|
||||||
Actions: []*PostAction{
|
Actions: []*PostAction{
|
||||||
&PostAction{
|
{
|
||||||
Integration: &PostActionIntegration{
|
Integration: &PostActionIntegration{
|
||||||
Context: map[string]interface{}{
|
Context: map[string]interface{}{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
@@ -37,9 +37,9 @@ func TestClient4CreatePost(t *testing.T) {
|
|||||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
attachments := PostFromJson(r.Body).Attachments()
|
attachments := PostFromJson(r.Body).Attachments()
|
||||||
assert.Equal(t, []*SlackAttachment{
|
assert.Equal(t, []*SlackAttachment{
|
||||||
&SlackAttachment{
|
{
|
||||||
Actions: []*PostAction{
|
Actions: []*PostAction{
|
||||||
&PostAction{
|
{
|
||||||
Integration: &PostActionIntegration{
|
Integration: &PostActionIntegration{
|
||||||
Context: map[string]interface{}{
|
Context: map[string]interface{}{
|
||||||
"foo": "bar",
|
"foo": "bar",
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ func TestCommandResponseFromJson(t *testing.T) {
|
|||||||
&CommandResponse{
|
&CommandResponse{
|
||||||
Text: "message 1",
|
Text: "message 1",
|
||||||
ExtraResponses: []*CommandResponse{
|
ExtraResponses: []*CommandResponse{
|
||||||
&CommandResponse{
|
{
|
||||||
Text: "message 2",
|
Text: "message 2",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -180,7 +180,7 @@ func TestCommandResponseFromJson(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
ExtraResponses: []*CommandResponse{
|
ExtraResponses: []*CommandResponse{
|
||||||
&CommandResponse{
|
{
|
||||||
Text: "message 2",
|
Text: "message 2",
|
||||||
Attachments: []*SlackAttachment{
|
Attachments: []*SlackAttachment{
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -305,8 +305,8 @@ func TestTruncateOpenGraph(t *testing.T) {
|
|||||||
sampleImage("metoo.gif"),
|
sampleImage("metoo.gif"),
|
||||||
sampleImage("fifth.ico"),
|
sampleImage("fifth.ico"),
|
||||||
sampleImage("notme.tiff")},
|
sampleImage("notme.tiff")},
|
||||||
Audios: []*opengraph.Audio{&opengraph.Audio{}},
|
Audios: []*opengraph.Audio{{}},
|
||||||
Videos: []*opengraph.Video{&opengraph.Video{}},
|
Videos: []*opengraph.Video{{}},
|
||||||
Article: &opengraph.Article{},
|
Article: &opengraph.Article{},
|
||||||
Book: &opengraph.Book{},
|
Book: &opengraph.Book{},
|
||||||
Profile: &opengraph.Profile{},
|
Profile: &opengraph.Profile{},
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ func TestManifestUnmarshal(t *testing.T) {
|
|||||||
Header: "theheadertext",
|
Header: "theheadertext",
|
||||||
Footer: "thefootertext",
|
Footer: "thefootertext",
|
||||||
Settings: []*PluginSetting{
|
Settings: []*PluginSetting{
|
||||||
&PluginSetting{
|
{
|
||||||
Key: "thesetting",
|
Key: "thesetting",
|
||||||
DisplayName: "thedisplayname",
|
DisplayName: "thedisplayname",
|
||||||
Type: "dropdown",
|
Type: "dropdown",
|
||||||
@@ -91,7 +91,7 @@ func TestManifestUnmarshal(t *testing.T) {
|
|||||||
RegenerateHelpText: "theregeneratehelptext",
|
RegenerateHelpText: "theregeneratehelptext",
|
||||||
Placeholder: "theplaceholder",
|
Placeholder: "theplaceholder",
|
||||||
Options: []*PluginOption{
|
Options: []*PluginOption{
|
||||||
&PluginOption{
|
{
|
||||||
DisplayName: "theoptiondisplayname",
|
DisplayName: "theoptiondisplayname",
|
||||||
Value: "thevalue",
|
Value: "thevalue",
|
||||||
},
|
},
|
||||||
@@ -232,7 +232,7 @@ func TestManifestJson(t *testing.T) {
|
|||||||
Header: "theheadertext",
|
Header: "theheadertext",
|
||||||
Footer: "thefootertext",
|
Footer: "thefootertext",
|
||||||
Settings: []*PluginSetting{
|
Settings: []*PluginSetting{
|
||||||
&PluginSetting{
|
{
|
||||||
Key: "thesetting",
|
Key: "thesetting",
|
||||||
DisplayName: "thedisplayname",
|
DisplayName: "thedisplayname",
|
||||||
Type: "dropdown",
|
Type: "dropdown",
|
||||||
@@ -240,7 +240,7 @@ func TestManifestJson(t *testing.T) {
|
|||||||
RegenerateHelpText: "theregeneratehelptext",
|
RegenerateHelpText: "theregeneratehelptext",
|
||||||
Placeholder: "theplaceholder",
|
Placeholder: "theplaceholder",
|
||||||
Options: []*PluginOption{
|
Options: []*PluginOption{
|
||||||
&PluginOption{
|
{
|
||||||
DisplayName: "theoptiondisplayname",
|
DisplayName: "theoptiondisplayname",
|
||||||
Value: "thevalue",
|
Value: "thevalue",
|
||||||
},
|
},
|
||||||
@@ -299,7 +299,7 @@ func TestManifestClientManifest(t *testing.T) {
|
|||||||
Header: "theheadertext",
|
Header: "theheadertext",
|
||||||
Footer: "thefootertext",
|
Footer: "thefootertext",
|
||||||
Settings: []*PluginSetting{
|
Settings: []*PluginSetting{
|
||||||
&PluginSetting{
|
{
|
||||||
Key: "thesetting",
|
Key: "thesetting",
|
||||||
DisplayName: "thedisplayname",
|
DisplayName: "thedisplayname",
|
||||||
Type: "dropdown",
|
Type: "dropdown",
|
||||||
@@ -307,7 +307,7 @@ func TestManifestClientManifest(t *testing.T) {
|
|||||||
RegenerateHelpText: "theregeneratehelptext",
|
RegenerateHelpText: "theregeneratehelptext",
|
||||||
Placeholder: "theplaceholder",
|
Placeholder: "theplaceholder",
|
||||||
Options: []*PluginOption{
|
Options: []*PluginOption{
|
||||||
&PluginOption{
|
{
|
||||||
DisplayName: "theoptiondisplayname",
|
DisplayName: "theoptiondisplayname",
|
||||||
Value: "thevalue",
|
Value: "thevalue",
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestSessionDeepCopy(t *testing.T) {
|
func TestSessionDeepCopy(t *testing.T) {
|
||||||
@@ -18,7 +18,7 @@ func TestSessionDeepCopy(t *testing.T) {
|
|||||||
mapKey := "key"
|
mapKey := "key"
|
||||||
mapValue := "val"
|
mapValue := "val"
|
||||||
|
|
||||||
session := &Session{Id: sessionId, Props: map[string]string{mapKey: mapValue}, TeamMembers: []*TeamMember{&TeamMember{UserId: userId, TeamId: "someteamId"}}}
|
session := &Session{Id: sessionId, Props: map[string]string{mapKey: mapValue}, TeamMembers: []*TeamMember{{UserId: userId, TeamId: "someteamId"}}}
|
||||||
|
|
||||||
copySession := session.DeepCopy()
|
copySession := session.DeepCopy()
|
||||||
copySession.Id = "changed"
|
copySession.Id = "changed"
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ func TestUserPreSave(t *testing.T) {
|
|||||||
user.PreSave()
|
user.PreSave()
|
||||||
user.Etag(true, true)
|
user.Etag(true, true)
|
||||||
assert.NotNil(t, user.Timezone, "Timezone is nil")
|
assert.NotNil(t, user.Timezone, "Timezone is nil")
|
||||||
assert.Equal(t, user.Timezone["useAutomaticTimezone"], "true", "Timezone is not set to default");
|
assert.Equal(t, user.Timezone["useAutomaticTimezone"], "true", "Timezone is not set to default")
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestUserPreUpdate(t *testing.T) {
|
func TestUserPreUpdate(t *testing.T) {
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ import (
|
|||||||
|
|
||||||
func createAudit(ss store.Store, userId, sessionId string) *model.Audit {
|
func createAudit(ss store.Store, userId, sessionId string) *model.Audit {
|
||||||
audit := model.Audit{
|
audit := model.Audit{
|
||||||
UserId: userId,
|
UserId: userId,
|
||||||
SessionId: sessionId,
|
SessionId: sessionId,
|
||||||
IpAddress: "ipaddress",
|
IpAddress: "ipaddress",
|
||||||
Action: "Action",
|
Action: "Action",
|
||||||
}
|
}
|
||||||
ss.Audit().Save(&audit)
|
ss.Audit().Save(&audit)
|
||||||
return &audit
|
return &audit
|
||||||
@@ -46,7 +46,7 @@ func createChannelWithSchemeId(ss store.Store, schemeId *string) *model.Channel
|
|||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
func createCommand(ss store.Store, userId, teamId string) * model.Command {
|
func createCommand(ss store.Store, userId, teamId string) *model.Command {
|
||||||
m := model.Command{}
|
m := model.Command{}
|
||||||
m.CreatorId = userId
|
m.CreatorId = userId
|
||||||
m.Method = model.COMMAND_METHOD_POST
|
m.Method = model.COMMAND_METHOD_POST
|
||||||
@@ -75,19 +75,19 @@ func createChannelMemberHistory(ss store.Store, channelId, userId string) *model
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createChannelWithTeamId(ss store.Store, id string) *model.Channel {
|
func createChannelWithTeamId(ss store.Store, id string) *model.Channel {
|
||||||
return createChannel(ss, id, model.NewId());
|
return createChannel(ss, id, model.NewId())
|
||||||
}
|
}
|
||||||
|
|
||||||
func createChannelWithCreatorId(ss store.Store, id string) *model.Channel {
|
func createChannelWithCreatorId(ss store.Store, id string) *model.Channel {
|
||||||
return createChannel(ss, model.NewId(), id);
|
return createChannel(ss, model.NewId(), id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func createChannelMemberWithChannelId(ss store.Store, id string) *model.ChannelMember {
|
func createChannelMemberWithChannelId(ss store.Store, id string) *model.ChannelMember {
|
||||||
return createChannelMember(ss, id, model.NewId());
|
return createChannelMember(ss, id, model.NewId())
|
||||||
}
|
}
|
||||||
|
|
||||||
func createChannelMemberWithUserId(ss store.Store, id string) *model.ChannelMember {
|
func createChannelMemberWithUserId(ss store.Store, id string) *model.ChannelMember {
|
||||||
return createChannelMember(ss, model.NewId(), id);
|
return createChannelMember(ss, model.NewId(), id)
|
||||||
}
|
}
|
||||||
|
|
||||||
func createCommandWebhook(ss store.Store, commandId, userId, channelId string) *model.CommandWebhook {
|
func createCommandWebhook(ss store.Store, commandId, userId, channelId string) *model.CommandWebhook {
|
||||||
@@ -192,20 +192,20 @@ func createPost(ss store.Store, channelId, userId, rootId, parentId string) *mod
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createPostWithChannelId(ss store.Store, id string) *model.Post {
|
func createPostWithChannelId(ss store.Store, id string) *model.Post {
|
||||||
return createPost(ss, id, model.NewId(), "", "");
|
return createPost(ss, id, model.NewId(), "", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func createPostWithUserId(ss store.Store, id string) *model.Post {
|
func createPostWithUserId(ss store.Store, id string) *model.Post {
|
||||||
return createPost(ss, model.NewId(), id, "", "");
|
return createPost(ss, model.NewId(), id, "", "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func createPreferences(ss store.Store, userId string) *model.Preferences {
|
func createPreferences(ss store.Store, userId string) *model.Preferences {
|
||||||
preferences := model.Preferences{
|
preferences := model.Preferences{
|
||||||
{
|
{
|
||||||
UserId: userId,
|
UserId: userId,
|
||||||
Name: model.NewId(),
|
Name: model.NewId(),
|
||||||
Category: model.PREFERENCE_CATEGORY_DIRECT_CHANNEL_SHOW,
|
Category: model.PREFERENCE_CATEGORY_DIRECT_CHANNEL_SHOW,
|
||||||
Value: "somevalue",
|
Value: "somevalue",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
ss.Preference().Save(&preferences)
|
ss.Preference().Save(&preferences)
|
||||||
@@ -369,10 +369,10 @@ func TestCheckParentChildIntegrity(t *testing.T) {
|
|||||||
supplier := ss.(*store.LayeredStore).DatabaseLayer.(*SqlSupplier)
|
supplier := ss.(*store.LayeredStore).DatabaseLayer.(*SqlSupplier)
|
||||||
t.Run("should receive an error", func(t *testing.T) {
|
t.Run("should receive an error", func(t *testing.T) {
|
||||||
config := relationalCheckConfig{
|
config := relationalCheckConfig{
|
||||||
parentName: "NotValid",
|
parentName: "NotValid",
|
||||||
parentIdAttr: "NotValid",
|
parentIdAttr: "NotValid",
|
||||||
childName: "NotValid",
|
childName: "NotValid",
|
||||||
childIdAttr: "NotValid",
|
childIdAttr: "NotValid",
|
||||||
}
|
}
|
||||||
result := checkParentChildIntegrity(supplier, config)
|
result := checkParentChildIntegrity(supplier, config)
|
||||||
require.NotNil(t, result.Err)
|
require.NotNil(t, result.Err)
|
||||||
@@ -402,7 +402,7 @@ func TestCheckChannelsCommandWebhooksIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: channelId,
|
ParentId: channelId,
|
||||||
ChildId: cwh.Id,
|
ChildId: cwh.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(cwh)
|
dbmap.Delete(cwh)
|
||||||
})
|
})
|
||||||
@@ -488,7 +488,7 @@ func TestCheckChannelsIncomingWebhooksIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: channelId,
|
ParentId: channelId,
|
||||||
ChildId: wh.Id,
|
ChildId: wh.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(wh)
|
dbmap.Delete(wh)
|
||||||
})
|
})
|
||||||
@@ -518,7 +518,7 @@ func TestCheckChannelsOutgoingWebhooksIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: channelId,
|
ParentId: channelId,
|
||||||
ChildId: wh.Id,
|
ChildId: wh.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(wh)
|
dbmap.Delete(wh)
|
||||||
})
|
})
|
||||||
@@ -545,7 +545,7 @@ func TestCheckChannelsPostsIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: post.ChannelId,
|
ParentId: post.ChannelId,
|
||||||
ChildId: post.Id,
|
ChildId: post.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(post)
|
dbmap.Delete(post)
|
||||||
})
|
})
|
||||||
@@ -573,7 +573,7 @@ func TestCheckCommandsCommandWebhooksIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: commandId,
|
ParentId: commandId,
|
||||||
ChildId: cwh.Id,
|
ChildId: cwh.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(cwh)
|
dbmap.Delete(cwh)
|
||||||
})
|
})
|
||||||
@@ -631,7 +631,7 @@ func TestCheckPostsPostsParentIdIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: parentId,
|
ParentId: parentId,
|
||||||
ChildId: post.Id,
|
ChildId: post.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(root)
|
dbmap.Delete(root)
|
||||||
dbmap.Delete(post)
|
dbmap.Delete(post)
|
||||||
@@ -662,7 +662,7 @@ func TestCheckPostsPostsRootIdIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: rootId,
|
ParentId: rootId,
|
||||||
ChildId: post.Id,
|
ChildId: post.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(post)
|
dbmap.Delete(post)
|
||||||
})
|
})
|
||||||
@@ -720,7 +720,7 @@ func TestCheckSchemesChannelsIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: schemeId,
|
ParentId: schemeId,
|
||||||
ChildId: channel.Id,
|
ChildId: channel.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(channel)
|
dbmap.Delete(channel)
|
||||||
})
|
})
|
||||||
@@ -751,7 +751,7 @@ func TestCheckSchemesTeamsIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: schemeId,
|
ParentId: schemeId,
|
||||||
ChildId: team.Id,
|
ChildId: team.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(team)
|
dbmap.Delete(team)
|
||||||
})
|
})
|
||||||
@@ -782,7 +782,7 @@ func TestCheckSessionsAuditsIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: sessionId,
|
ParentId: sessionId,
|
||||||
ChildId: audit.Id,
|
ChildId: audit.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
ss.Audit().PermanentDeleteByUser(userId)
|
ss.Audit().PermanentDeleteByUser(userId)
|
||||||
})
|
})
|
||||||
@@ -809,7 +809,7 @@ func TestCheckTeamsChannelsIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: channel.TeamId,
|
ParentId: channel.TeamId,
|
||||||
ChildId: channel.Id,
|
ChildId: channel.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(channel)
|
dbmap.Delete(channel)
|
||||||
})
|
})
|
||||||
@@ -837,7 +837,7 @@ func TestCheckTeamsCommandsIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: teamId,
|
ParentId: teamId,
|
||||||
ChildId: cmd.Id,
|
ChildId: cmd.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(cmd)
|
dbmap.Delete(cmd)
|
||||||
})
|
})
|
||||||
@@ -865,7 +865,7 @@ func TestCheckTeamsIncomingWebhooksIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: teamId,
|
ParentId: teamId,
|
||||||
ChildId: wh.Id,
|
ChildId: wh.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(wh)
|
dbmap.Delete(wh)
|
||||||
})
|
})
|
||||||
@@ -893,7 +893,7 @@ func TestCheckTeamsOutgoingWebhooksIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: teamId,
|
ParentId: teamId,
|
||||||
ChildId: wh.Id,
|
ChildId: wh.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(wh)
|
dbmap.Delete(wh)
|
||||||
})
|
})
|
||||||
@@ -951,7 +951,7 @@ func TestCheckUsersAuditsIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: userId,
|
ParentId: userId,
|
||||||
ChildId: audit.Id,
|
ChildId: audit.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
ss.Audit().PermanentDeleteByUser(userId)
|
ss.Audit().PermanentDeleteByUser(userId)
|
||||||
})
|
})
|
||||||
@@ -979,7 +979,7 @@ func TestCheckUsersCommandWebhooksIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: userId,
|
ParentId: userId,
|
||||||
ChildId: cwh.Id,
|
ChildId: cwh.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(cwh)
|
dbmap.Delete(cwh)
|
||||||
})
|
})
|
||||||
@@ -1006,7 +1006,7 @@ func TestCheckUsersChannelsIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: channel.CreatorId,
|
ParentId: channel.CreatorId,
|
||||||
ChildId: channel.Id,
|
ChildId: channel.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(channel)
|
dbmap.Delete(channel)
|
||||||
})
|
})
|
||||||
@@ -1094,7 +1094,7 @@ func TestCheckUsersCommandsIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: userId,
|
ParentId: userId,
|
||||||
ChildId: cmd.Id,
|
ChildId: cmd.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(cmd)
|
dbmap.Delete(cmd)
|
||||||
})
|
})
|
||||||
@@ -1124,7 +1124,7 @@ func TestCheckUsersCompliancesIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: userId,
|
ParentId: userId,
|
||||||
ChildId: compliance.Id,
|
ChildId: compliance.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(compliance)
|
dbmap.Delete(compliance)
|
||||||
})
|
})
|
||||||
@@ -1154,7 +1154,7 @@ func TestCheckUsersEmojiIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: userId,
|
ParentId: userId,
|
||||||
ChildId: emoji.Id,
|
ChildId: emoji.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(emoji)
|
dbmap.Delete(emoji)
|
||||||
})
|
})
|
||||||
@@ -1211,7 +1211,7 @@ func TestCheckUsersIncomingWebhooksIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: userId,
|
ParentId: userId,
|
||||||
ChildId: wh.Id,
|
ChildId: wh.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(wh)
|
dbmap.Delete(wh)
|
||||||
})
|
})
|
||||||
@@ -1241,7 +1241,7 @@ func TestCheckUsersOAuthAccessDataIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: userId,
|
ParentId: userId,
|
||||||
ChildId: ad.Token,
|
ChildId: ad.Token,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
ss.OAuth().RemoveAccessData(ad.Token)
|
ss.OAuth().RemoveAccessData(ad.Token)
|
||||||
})
|
})
|
||||||
@@ -1271,7 +1271,7 @@ func TestCheckUsersOAuthAppsIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: userId,
|
ParentId: userId,
|
||||||
ChildId: app.Id,
|
ChildId: app.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
ss.OAuth().DeleteApp(app.Id)
|
ss.OAuth().DeleteApp(app.Id)
|
||||||
})
|
})
|
||||||
@@ -1301,7 +1301,7 @@ func TestCheckUsersOAuthAuthDataIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: userId,
|
ParentId: userId,
|
||||||
ChildId: ad.Code,
|
ChildId: ad.Code,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
ss.OAuth().RemoveAuthData(ad.Code)
|
ss.OAuth().RemoveAuthData(ad.Code)
|
||||||
})
|
})
|
||||||
@@ -1329,7 +1329,7 @@ func TestCheckUsersOutgoingWebhooksIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: userId,
|
ParentId: userId,
|
||||||
ChildId: wh.Id,
|
ChildId: wh.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(wh)
|
dbmap.Delete(wh)
|
||||||
})
|
})
|
||||||
@@ -1356,7 +1356,7 @@ func TestCheckUsersPostsIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: post.UserId,
|
ParentId: post.UserId,
|
||||||
ChildId: post.Id,
|
ChildId: post.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(post)
|
dbmap.Delete(post)
|
||||||
})
|
})
|
||||||
@@ -1442,7 +1442,7 @@ func TestCheckUsersSessionsIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: userId,
|
ParentId: userId,
|
||||||
ChildId: session.Id,
|
ChildId: session.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
dbmap.Delete(session)
|
dbmap.Delete(session)
|
||||||
})
|
})
|
||||||
@@ -1531,7 +1531,7 @@ func TestCheckUsersUserAccessTokensIntegrity(t *testing.T) {
|
|||||||
require.Len(t, data.Records, 1)
|
require.Len(t, data.Records, 1)
|
||||||
require.Equal(t, store.OrphanedRecord{
|
require.Equal(t, store.OrphanedRecord{
|
||||||
ParentId: userId,
|
ParentId: userId,
|
||||||
ChildId: uat.Id,
|
ChildId: uat.Id,
|
||||||
}, data.Records[0])
|
}, data.Records[0])
|
||||||
ss.UserAccessToken().Delete(uat.Id)
|
ss.UserAccessToken().Delete(uat.Id)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ func TestIsPasswordValidWithSettings(t *testing.T) {
|
|||||||
Password: strings.Repeat("x", 3),
|
Password: strings.Repeat("x", 3),
|
||||||
Settings: &model.PasswordSettings{
|
Settings: &model.PasswordSettings{
|
||||||
MinimumLength: model.NewInt(3),
|
MinimumLength: model.NewInt(3),
|
||||||
Lowercase: model.NewBool(false),
|
Lowercase: model.NewBool(false),
|
||||||
Uppercase: model.NewBool(false),
|
Uppercase: model.NewBool(false),
|
||||||
Number: model.NewBool(false),
|
Number: model.NewBool(false),
|
||||||
Symbol: model.NewBool(false),
|
Symbol: model.NewBool(false),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"Long": {
|
"Long": {
|
||||||
@@ -30,28 +30,28 @@ func TestIsPasswordValidWithSettings(t *testing.T) {
|
|||||||
Settings: &model.PasswordSettings{
|
Settings: &model.PasswordSettings{
|
||||||
Lowercase: model.NewBool(false),
|
Lowercase: model.NewBool(false),
|
||||||
Uppercase: model.NewBool(false),
|
Uppercase: model.NewBool(false),
|
||||||
Number: model.NewBool(false),
|
Number: model.NewBool(false),
|
||||||
Symbol: model.NewBool(false),
|
Symbol: model.NewBool(false),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"TooShort": {
|
"TooShort": {
|
||||||
Password: strings.Repeat("x", 2),
|
Password: strings.Repeat("x", 2),
|
||||||
Settings: &model.PasswordSettings{
|
Settings: &model.PasswordSettings{
|
||||||
MinimumLength: model.NewInt(3),
|
MinimumLength: model.NewInt(3),
|
||||||
Lowercase: model.NewBool(false),
|
Lowercase: model.NewBool(false),
|
||||||
Uppercase: model.NewBool(false),
|
Uppercase: model.NewBool(false),
|
||||||
Number: model.NewBool(false),
|
Number: model.NewBool(false),
|
||||||
Symbol: model.NewBool(false),
|
Symbol: model.NewBool(false),
|
||||||
},
|
},
|
||||||
ExpectedError: "model.user.is_valid.pwd.app_error",
|
ExpectedError: "model.user.is_valid.pwd.app_error",
|
||||||
},
|
},
|
||||||
"TooLong": {
|
"TooLong": {
|
||||||
Password: strings.Repeat("x", model.PASSWORD_MAXIMUM_LENGTH+1),
|
Password: strings.Repeat("x", model.PASSWORD_MAXIMUM_LENGTH+1),
|
||||||
Settings: &model.PasswordSettings{
|
Settings: &model.PasswordSettings{
|
||||||
Lowercase: model.NewBool(false),
|
Lowercase: model.NewBool(false),
|
||||||
Uppercase: model.NewBool(false),
|
Uppercase: model.NewBool(false),
|
||||||
Number: model.NewBool(false),
|
Number: model.NewBool(false),
|
||||||
Symbol: model.NewBool(false),
|
Symbol: model.NewBool(false),
|
||||||
},
|
},
|
||||||
ExpectedError: "model.user.is_valid.pwd.app_error",
|
ExpectedError: "model.user.is_valid.pwd.app_error",
|
||||||
},
|
},
|
||||||
@@ -60,8 +60,8 @@ func TestIsPasswordValidWithSettings(t *testing.T) {
|
|||||||
Settings: &model.PasswordSettings{
|
Settings: &model.PasswordSettings{
|
||||||
Lowercase: model.NewBool(true),
|
Lowercase: model.NewBool(true),
|
||||||
Uppercase: model.NewBool(false),
|
Uppercase: model.NewBool(false),
|
||||||
Number: model.NewBool(false),
|
Number: model.NewBool(false),
|
||||||
Symbol: model.NewBool(false),
|
Symbol: model.NewBool(false),
|
||||||
},
|
},
|
||||||
ExpectedError: "model.user.is_valid.pwd_lowercase.app_error",
|
ExpectedError: "model.user.is_valid.pwd_lowercase.app_error",
|
||||||
},
|
},
|
||||||
@@ -70,28 +70,28 @@ func TestIsPasswordValidWithSettings(t *testing.T) {
|
|||||||
Settings: &model.PasswordSettings{
|
Settings: &model.PasswordSettings{
|
||||||
Uppercase: model.NewBool(true),
|
Uppercase: model.NewBool(true),
|
||||||
Lowercase: model.NewBool(false),
|
Lowercase: model.NewBool(false),
|
||||||
Number: model.NewBool(false),
|
Number: model.NewBool(false),
|
||||||
Symbol: model.NewBool(false),
|
Symbol: model.NewBool(false),
|
||||||
},
|
},
|
||||||
ExpectedError: "model.user.is_valid.pwd_uppercase.app_error",
|
ExpectedError: "model.user.is_valid.pwd_uppercase.app_error",
|
||||||
},
|
},
|
||||||
"MissingNumber": {
|
"MissingNumber": {
|
||||||
Password: "asasdasdsadASD!@#",
|
Password: "asasdasdsadASD!@#",
|
||||||
Settings: &model.PasswordSettings{
|
Settings: &model.PasswordSettings{
|
||||||
Number: model.NewBool(true),
|
Number: model.NewBool(true),
|
||||||
Lowercase: model.NewBool(false),
|
Lowercase: model.NewBool(false),
|
||||||
Uppercase: model.NewBool(false),
|
Uppercase: model.NewBool(false),
|
||||||
Symbol: model.NewBool(false),
|
Symbol: model.NewBool(false),
|
||||||
},
|
},
|
||||||
ExpectedError: "model.user.is_valid.pwd_number.app_error",
|
ExpectedError: "model.user.is_valid.pwd_number.app_error",
|
||||||
},
|
},
|
||||||
"MissingSymbol": {
|
"MissingSymbol": {
|
||||||
Password: "asdasdasdasdasdASD123",
|
Password: "asdasdasdasdasdASD123",
|
||||||
Settings: &model.PasswordSettings{
|
Settings: &model.PasswordSettings{
|
||||||
Symbol: model.NewBool(true),
|
Symbol: model.NewBool(true),
|
||||||
Lowercase: model.NewBool(false),
|
Lowercase: model.NewBool(false),
|
||||||
Uppercase: model.NewBool(false),
|
Uppercase: model.NewBool(false),
|
||||||
Number: model.NewBool(false),
|
Number: model.NewBool(false),
|
||||||
},
|
},
|
||||||
ExpectedError: "model.user.is_valid.pwd_symbol.app_error",
|
ExpectedError: "model.user.is_valid.pwd_symbol.app_error",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user