Run gofmt -s against codebase (#12943)
Этот коммит содержится в:
@@ -5,6 +5,8 @@ run:
|
||||
linters-settings:
|
||||
govet:
|
||||
check-shadowing: true
|
||||
gofmt:
|
||||
simplify: true
|
||||
|
||||
linters:
|
||||
disable-all: true
|
||||
|
||||
@@ -112,7 +112,7 @@ func TestOpenDialog(t *testing.T) {
|
||||
CallbackId: "callbackid",
|
||||
Title: "Some Title",
|
||||
Elements: []model.DialogElement{
|
||||
model.DialogElement{
|
||||
{
|
||||
DisplayName: "Element Name",
|
||||
Name: "element_name",
|
||||
Type: "text",
|
||||
|
||||
@@ -387,7 +387,7 @@ func TestDisableOnRemove(t *testing.T) {
|
||||
pluginsResp, resp := th.SystemAdminClient.GetPlugins()
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, pluginsResp.Active, 0)
|
||||
require.Equal(t, pluginsResp.Inactive, []*model.PluginInfo{&model.PluginInfo{
|
||||
require.Equal(t, pluginsResp.Inactive, []*model.PluginInfo{{
|
||||
Manifest: *manifest,
|
||||
}})
|
||||
|
||||
@@ -400,7 +400,7 @@ func TestDisableOnRemove(t *testing.T) {
|
||||
pluginsResp, resp = th.SystemAdminClient.GetPlugins()
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, pluginsResp.Inactive, 0)
|
||||
require.Equal(t, pluginsResp.Active, []*model.PluginInfo{&model.PluginInfo{
|
||||
require.Equal(t, pluginsResp.Active, []*model.PluginInfo{{
|
||||
Manifest: *manifest,
|
||||
}})
|
||||
|
||||
@@ -414,7 +414,7 @@ func TestDisableOnRemove(t *testing.T) {
|
||||
pluginsResp, resp = th.SystemAdminClient.GetPlugins()
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, pluginsResp.Inactive, 0)
|
||||
require.Equal(t, pluginsResp.Active, []*model.PluginInfo{&model.PluginInfo{
|
||||
require.Equal(t, pluginsResp.Active, []*model.PluginInfo{{
|
||||
Manifest: *manifest,
|
||||
}})
|
||||
}
|
||||
@@ -439,7 +439,7 @@ func TestDisableOnRemove(t *testing.T) {
|
||||
pluginsResp, resp = th.SystemAdminClient.GetPlugins()
|
||||
CheckNoError(t, resp)
|
||||
require.Len(t, pluginsResp.Active, 0)
|
||||
require.Equal(t, pluginsResp.Inactive, []*model.PluginInfo{&model.PluginInfo{
|
||||
require.Equal(t, pluginsResp.Inactive, []*model.PluginInfo{{
|
||||
Manifest: *manifest,
|
||||
}})
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ func TestWebSocket(t *testing.T) {
|
||||
WebSocketClient.SendMessage("ping", nil)
|
||||
time.Sleep(300 * time.Millisecond)
|
||||
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)
|
||||
time.Sleep(300 * time.Millisecond)
|
||||
|
||||
@@ -69,7 +69,7 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
assert.Equal(t, len(roles1), len(roleNames))
|
||||
|
||||
expected1 := map[string][]string{
|
||||
"channel_user": []string{
|
||||
"channel_user": {
|
||||
model.PERMISSION_READ_CHANNEL.Id,
|
||||
model.PERMISSION_ADD_REACTION.Id,
|
||||
model.PERMISSION_REMOVE_REACTION.Id,
|
||||
@@ -86,10 +86,10 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
model.PERMISSION_DELETE_POST.Id,
|
||||
model.PERMISSION_EDIT_POST.Id,
|
||||
},
|
||||
"channel_admin": []string{
|
||||
"channel_admin": {
|
||||
model.PERMISSION_MANAGE_CHANNEL_ROLES.Id,
|
||||
},
|
||||
"team_user": []string{
|
||||
"team_user": {
|
||||
model.PERMISSION_LIST_TEAM_CHANNELS.Id,
|
||||
model.PERMISSION_JOIN_PUBLIC_CHANNELS.Id,
|
||||
model.PERMISSION_READ_PUBLIC_CHANNEL.Id,
|
||||
@@ -99,13 +99,13 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
model.PERMISSION_INVITE_USER.Id,
|
||||
model.PERMISSION_ADD_USER_TO_TEAM.Id,
|
||||
},
|
||||
"team_post_all": []string{
|
||||
"team_post_all": {
|
||||
model.PERMISSION_CREATE_POST.Id,
|
||||
},
|
||||
"team_post_all_public": []string{
|
||||
"team_post_all_public": {
|
||||
model.PERMISSION_CREATE_POST_PUBLIC.Id,
|
||||
},
|
||||
"team_admin": []string{
|
||||
"team_admin": {
|
||||
model.PERMISSION_REMOVE_USER_FROM_TEAM.Id,
|
||||
model.PERMISSION_MANAGE_TEAM.Id,
|
||||
model.PERMISSION_IMPORT_TEAM.Id,
|
||||
@@ -120,7 +120,7 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
model.PERMISSION_DELETE_POST.Id,
|
||||
model.PERMISSION_DELETE_OTHERS_POSTS.Id,
|
||||
},
|
||||
"system_user": []string{
|
||||
"system_user": {
|
||||
model.PERMISSION_LIST_PUBLIC_TEAMS.Id,
|
||||
model.PERMISSION_JOIN_PUBLIC_TEAMS.Id,
|
||||
model.PERMISSION_CREATE_DIRECT_CHANNEL.Id,
|
||||
@@ -128,18 +128,18 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
model.PERMISSION_VIEW_MEMBERS.Id,
|
||||
model.PERMISSION_CREATE_TEAM.Id,
|
||||
},
|
||||
"system_post_all": []string{
|
||||
"system_post_all": {
|
||||
model.PERMISSION_CREATE_POST.Id,
|
||||
},
|
||||
"system_post_all_public": []string{
|
||||
"system_post_all_public": {
|
||||
model.PERMISSION_CREATE_POST_PUBLIC.Id,
|
||||
},
|
||||
"system_user_access_token": []string{
|
||||
"system_user_access_token": {
|
||||
model.PERMISSION_CREATE_USER_ACCESS_TOKEN.Id,
|
||||
model.PERMISSION_READ_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_MANAGE_SYSTEM.Id,
|
||||
model.PERMISSION_MANAGE_ROLES.Id,
|
||||
@@ -254,7 +254,7 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
|
||||
// Check the role permissions.
|
||||
expected2 := map[string][]string{
|
||||
"channel_user": []string{
|
||||
"channel_user": {
|
||||
model.PERMISSION_READ_CHANNEL.Id,
|
||||
model.PERMISSION_ADD_REACTION.Id,
|
||||
model.PERMISSION_REMOVE_REACTION.Id,
|
||||
@@ -269,10 +269,10 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
model.PERMISSION_DELETE_POST.Id,
|
||||
model.PERMISSION_EDIT_POST.Id,
|
||||
},
|
||||
"channel_admin": []string{
|
||||
"channel_admin": {
|
||||
model.PERMISSION_MANAGE_CHANNEL_ROLES.Id,
|
||||
},
|
||||
"team_user": []string{
|
||||
"team_user": {
|
||||
model.PERMISSION_LIST_TEAM_CHANNELS.Id,
|
||||
model.PERMISSION_JOIN_PUBLIC_CHANNELS.Id,
|
||||
model.PERMISSION_READ_PUBLIC_CHANNEL.Id,
|
||||
@@ -282,13 +282,13 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
model.PERMISSION_INVITE_USER.Id,
|
||||
model.PERMISSION_ADD_USER_TO_TEAM.Id,
|
||||
},
|
||||
"team_post_all": []string{
|
||||
"team_post_all": {
|
||||
model.PERMISSION_CREATE_POST.Id,
|
||||
},
|
||||
"team_post_all_public": []string{
|
||||
"team_post_all_public": {
|
||||
model.PERMISSION_CREATE_POST_PUBLIC.Id,
|
||||
},
|
||||
"team_admin": []string{
|
||||
"team_admin": {
|
||||
model.PERMISSION_REMOVE_USER_FROM_TEAM.Id,
|
||||
model.PERMISSION_MANAGE_TEAM.Id,
|
||||
model.PERMISSION_IMPORT_TEAM.Id,
|
||||
@@ -305,7 +305,7 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
model.PERMISSION_DELETE_POST.Id,
|
||||
model.PERMISSION_DELETE_OTHERS_POSTS.Id,
|
||||
},
|
||||
"system_user": []string{
|
||||
"system_user": {
|
||||
model.PERMISSION_LIST_PUBLIC_TEAMS.Id,
|
||||
model.PERMISSION_JOIN_PUBLIC_TEAMS.Id,
|
||||
model.PERMISSION_CREATE_DIRECT_CHANNEL.Id,
|
||||
@@ -313,18 +313,18 @@ func TestDoAdvancedPermissionsMigration(t *testing.T) {
|
||||
model.PERMISSION_VIEW_MEMBERS.Id,
|
||||
model.PERMISSION_CREATE_TEAM.Id,
|
||||
},
|
||||
"system_post_all": []string{
|
||||
"system_post_all": {
|
||||
model.PERMISSION_CREATE_POST.Id,
|
||||
},
|
||||
"system_post_all_public": []string{
|
||||
"system_post_all_public": {
|
||||
model.PERMISSION_CREATE_POST_PUBLIC.Id,
|
||||
},
|
||||
"system_user_access_token": []string{
|
||||
"system_user_access_token": {
|
||||
model.PERMISSION_CREATE_USER_ACCESS_TOKEN.Id,
|
||||
model.PERMISSION_READ_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_MANAGE_SYSTEM.Id,
|
||||
model.PERMISSION_MANAGE_ROLES.Id,
|
||||
|
||||
@@ -189,7 +189,7 @@ func TestHandleCommandResponsePost(t *testing.T) {
|
||||
|
||||
// Test Slack attachments text conversion.
|
||||
resp.Attachments = []*model.SlackAttachment{
|
||||
&model.SlackAttachment{
|
||||
{
|
||||
Text: "<!here>",
|
||||
},
|
||||
}
|
||||
@@ -212,7 +212,7 @@ func TestHandleCommandResponsePost(t *testing.T) {
|
||||
resp.ChannelId = ""
|
||||
resp.Text = "<test.com|test website>"
|
||||
resp.Attachments = []*model.SlackAttachment{
|
||||
&model.SlackAttachment{
|
||||
{
|
||||
Text: "<!here>",
|
||||
},
|
||||
}
|
||||
@@ -257,10 +257,10 @@ func TestHandleCommandResponse(t *testing.T) {
|
||||
resp = &model.CommandResponse{
|
||||
Text: "message 1",
|
||||
ExtraResponses: []*model.CommandResponse{
|
||||
&model.CommandResponse{
|
||||
{
|
||||
Text: "message 2",
|
||||
},
|
||||
&model.CommandResponse{
|
||||
{
|
||||
Type: model.POST_SYSTEM_GENERIC,
|
||||
Text: "message 3",
|
||||
},
|
||||
@@ -274,8 +274,8 @@ func TestHandleCommandResponse(t *testing.T) {
|
||||
|
||||
resp = &model.CommandResponse{
|
||||
ExtraResponses: []*model.CommandResponse{
|
||||
&model.CommandResponse{},
|
||||
&model.CommandResponse{},
|
||||
{},
|
||||
{},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
func TestPluginSetting(t *testing.T) {
|
||||
settings := &model.PluginSettings{
|
||||
Plugins: map[string]map[string]interface{}{
|
||||
"test": map[string]interface{}{
|
||||
"test": {
|
||||
"foo": "bar",
|
||||
},
|
||||
},
|
||||
@@ -31,10 +31,10 @@ func TestPluginSetting(t *testing.T) {
|
||||
|
||||
func TestPluginActivated(t *testing.T) {
|
||||
states := map[string]*model.PluginState{
|
||||
"foo": &model.PluginState{
|
||||
"foo": {
|
||||
Enable: true,
|
||||
},
|
||||
"bar": &model.PluginState{
|
||||
"bar": {
|
||||
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: id2}, &model.Post{UserId: id1, Message: "test5"}, &model.Team{Name: "team"})
|
||||
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][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[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[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][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][1].post.Message, "test5", "incorrect order of received posts for user2")
|
||||
}
|
||||
|
||||
func TestCheckPendingNotifications(t *testing.T) {
|
||||
|
||||
@@ -487,7 +487,7 @@ func TestImportValidateUserImportData(t *testing.T) {
|
||||
|
||||
data.Username = ptrStr("i am a username with spaces and !!!")
|
||||
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")
|
||||
|
||||
@@ -759,7 +759,6 @@ func TestImportValidateReactionImportData(t *testing.T) {
|
||||
err = validateReactionImportData(&data, parentCreateAt)
|
||||
require.NotNil(t, err, "Should have failed due to missing required property.")
|
||||
|
||||
|
||||
data = ReactionImportData{
|
||||
User: ptrStr("username"),
|
||||
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.")
|
||||
|
||||
// Test with valid all optional parameters.
|
||||
reactions := []ReactionImportData{ReactionImportData{
|
||||
reactions := []ReactionImportData{{
|
||||
User: ptrStr("username"),
|
||||
EmojiName: ptrStr("emoji"),
|
||||
CreateAt: ptrInt64(model.GetMillis()),
|
||||
}}
|
||||
|
||||
replies := []ReplyImportData{ReplyImportData{
|
||||
replies := []ReplyImportData{{
|
||||
User: ptrStr("username"),
|
||||
Message: ptrStr("message"),
|
||||
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")
|
||||
|
||||
// Test with valid all optional parameters.
|
||||
reactions := []ReactionImportData{ReactionImportData{
|
||||
reactions := []ReactionImportData{{
|
||||
User: ptrStr("username"),
|
||||
EmojiName: ptrStr("emoji"),
|
||||
CreateAt: ptrInt64(model.GetMillis()),
|
||||
}}
|
||||
|
||||
replies := []ReplyImportData{ReplyImportData{
|
||||
replies := []ReplyImportData{{
|
||||
User: ptrStr("username"),
|
||||
Message: ptrStr("message"),
|
||||
CreateAt: ptrInt64(model.GetMillis()),
|
||||
|
||||
@@ -389,13 +389,13 @@ func TestSplitWebhookPost(t *testing.T) {
|
||||
Message: strings.Repeat("本", maxPostSize*3/2),
|
||||
Props: map[string]interface{}{
|
||||
"attachments": []*model.SlackAttachment{
|
||||
&model.SlackAttachment{
|
||||
{
|
||||
Text: strings.Repeat("本", 1000),
|
||||
},
|
||||
&model.SlackAttachment{
|
||||
{
|
||||
Text: strings.Repeat("本", 2000),
|
||||
},
|
||||
&model.SlackAttachment{
|
||||
{
|
||||
Text: strings.Repeat("本", model.POST_PROPS_MAX_USER_RUNES-1000),
|
||||
},
|
||||
},
|
||||
@@ -409,10 +409,10 @@ func TestSplitWebhookPost(t *testing.T) {
|
||||
Message: strings.Repeat("本", maxPostSize/2),
|
||||
Props: map[string]interface{}{
|
||||
"attachments": []*model.SlackAttachment{
|
||||
&model.SlackAttachment{
|
||||
{
|
||||
Text: strings.Repeat("本", 1000),
|
||||
},
|
||||
&model.SlackAttachment{
|
||||
{
|
||||
Text: strings.Repeat("本", 2000),
|
||||
},
|
||||
},
|
||||
@@ -421,7 +421,7 @@ func TestSplitWebhookPost(t *testing.T) {
|
||||
{
|
||||
Props: map[string]interface{}{
|
||||
"attachments": []*model.SlackAttachment{
|
||||
&model.SlackAttachment{
|
||||
{
|
||||
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")
|
||||
|
||||
|
||||
// should fail because using an invalid email
|
||||
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) {
|
||||
_, tearDown := setupConfigDatabase(t, minimalConfig, map[string][]byte{
|
||||
"empty-file": []byte{},
|
||||
"empty-file": {},
|
||||
"test-file": []byte("test"),
|
||||
})
|
||||
defer tearDown()
|
||||
|
||||
@@ -282,7 +282,7 @@ func TestMemoryGetFile(t *testing.T) {
|
||||
ms, err := config.NewMemoryStoreWithOptions(&config.MemoryStoreOptions{
|
||||
InitialConfig: minimalConfig,
|
||||
InitialFiles: map[string][]byte{
|
||||
"empty-file": []byte{},
|
||||
"empty-file": {},
|
||||
"test-file": []byte("test"),
|
||||
},
|
||||
})
|
||||
|
||||
@@ -17,9 +17,9 @@ func TestClient4CreatePost(t *testing.T) {
|
||||
post := &Post{
|
||||
Props: map[string]interface{}{
|
||||
"attachments": []*SlackAttachment{
|
||||
&SlackAttachment{
|
||||
{
|
||||
Actions: []*PostAction{
|
||||
&PostAction{
|
||||
{
|
||||
Integration: &PostActionIntegration{
|
||||
Context: map[string]interface{}{
|
||||
"foo": "bar",
|
||||
@@ -37,9 +37,9 @@ func TestClient4CreatePost(t *testing.T) {
|
||||
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
attachments := PostFromJson(r.Body).Attachments()
|
||||
assert.Equal(t, []*SlackAttachment{
|
||||
&SlackAttachment{
|
||||
{
|
||||
Actions: []*PostAction{
|
||||
&PostAction{
|
||||
{
|
||||
Integration: &PostActionIntegration{
|
||||
Context: map[string]interface{}{
|
||||
"foo": "bar",
|
||||
|
||||
@@ -146,7 +146,7 @@ func TestCommandResponseFromJson(t *testing.T) {
|
||||
&CommandResponse{
|
||||
Text: "message 1",
|
||||
ExtraResponses: []*CommandResponse{
|
||||
&CommandResponse{
|
||||
{
|
||||
Text: "message 2",
|
||||
},
|
||||
},
|
||||
@@ -180,7 +180,7 @@ func TestCommandResponseFromJson(t *testing.T) {
|
||||
},
|
||||
},
|
||||
ExtraResponses: []*CommandResponse{
|
||||
&CommandResponse{
|
||||
{
|
||||
Text: "message 2",
|
||||
Attachments: []*SlackAttachment{
|
||||
{
|
||||
|
||||
@@ -305,8 +305,8 @@ func TestTruncateOpenGraph(t *testing.T) {
|
||||
sampleImage("metoo.gif"),
|
||||
sampleImage("fifth.ico"),
|
||||
sampleImage("notme.tiff")},
|
||||
Audios: []*opengraph.Audio{&opengraph.Audio{}},
|
||||
Videos: []*opengraph.Video{&opengraph.Video{}},
|
||||
Audios: []*opengraph.Audio{{}},
|
||||
Videos: []*opengraph.Video{{}},
|
||||
Article: &opengraph.Article{},
|
||||
Book: &opengraph.Book{},
|
||||
Profile: &opengraph.Profile{},
|
||||
|
||||
@@ -83,7 +83,7 @@ func TestManifestUnmarshal(t *testing.T) {
|
||||
Header: "theheadertext",
|
||||
Footer: "thefootertext",
|
||||
Settings: []*PluginSetting{
|
||||
&PluginSetting{
|
||||
{
|
||||
Key: "thesetting",
|
||||
DisplayName: "thedisplayname",
|
||||
Type: "dropdown",
|
||||
@@ -91,7 +91,7 @@ func TestManifestUnmarshal(t *testing.T) {
|
||||
RegenerateHelpText: "theregeneratehelptext",
|
||||
Placeholder: "theplaceholder",
|
||||
Options: []*PluginOption{
|
||||
&PluginOption{
|
||||
{
|
||||
DisplayName: "theoptiondisplayname",
|
||||
Value: "thevalue",
|
||||
},
|
||||
@@ -232,7 +232,7 @@ func TestManifestJson(t *testing.T) {
|
||||
Header: "theheadertext",
|
||||
Footer: "thefootertext",
|
||||
Settings: []*PluginSetting{
|
||||
&PluginSetting{
|
||||
{
|
||||
Key: "thesetting",
|
||||
DisplayName: "thedisplayname",
|
||||
Type: "dropdown",
|
||||
@@ -240,7 +240,7 @@ func TestManifestJson(t *testing.T) {
|
||||
RegenerateHelpText: "theregeneratehelptext",
|
||||
Placeholder: "theplaceholder",
|
||||
Options: []*PluginOption{
|
||||
&PluginOption{
|
||||
{
|
||||
DisplayName: "theoptiondisplayname",
|
||||
Value: "thevalue",
|
||||
},
|
||||
@@ -299,7 +299,7 @@ func TestManifestClientManifest(t *testing.T) {
|
||||
Header: "theheadertext",
|
||||
Footer: "thefootertext",
|
||||
Settings: []*PluginSetting{
|
||||
&PluginSetting{
|
||||
{
|
||||
Key: "thesetting",
|
||||
DisplayName: "thedisplayname",
|
||||
Type: "dropdown",
|
||||
@@ -307,7 +307,7 @@ func TestManifestClientManifest(t *testing.T) {
|
||||
RegenerateHelpText: "theregeneratehelptext",
|
||||
Placeholder: "theplaceholder",
|
||||
Options: []*PluginOption{
|
||||
&PluginOption{
|
||||
{
|
||||
DisplayName: "theoptiondisplayname",
|
||||
Value: "thevalue",
|
||||
},
|
||||
|
||||
@@ -8,8 +8,8 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestSessionDeepCopy(t *testing.T) {
|
||||
@@ -18,7 +18,7 @@ func TestSessionDeepCopy(t *testing.T) {
|
||||
mapKey := "key"
|
||||
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.Id = "changed"
|
||||
|
||||
@@ -63,7 +63,7 @@ func TestUserPreSave(t *testing.T) {
|
||||
user.PreSave()
|
||||
user.Etag(true, true)
|
||||
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) {
|
||||
|
||||
@@ -46,7 +46,7 @@ func createChannelWithSchemeId(ss store.Store, schemeId *string) *model.Channel
|
||||
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.CreatorId = userId
|
||||
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 {
|
||||
return createChannel(ss, id, model.NewId());
|
||||
return createChannel(ss, id, model.NewId())
|
||||
}
|
||||
|
||||
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 {
|
||||
return createChannelMember(ss, id, model.NewId());
|
||||
return createChannelMember(ss, id, model.NewId())
|
||||
}
|
||||
|
||||
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 {
|
||||
@@ -192,11 +192,11 @@ func createPost(ss store.Store, channelId, userId, rootId, parentId string) *mod
|
||||
}
|
||||
|
||||
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 {
|
||||
return createPost(ss, model.NewId(), id, "", "");
|
||||
return createPost(ss, model.NewId(), id, "", "")
|
||||
}
|
||||
|
||||
func createPreferences(ss store.Store, userId string) *model.Preferences {
|
||||
|
||||
Ссылка в новой задаче
Block a user