mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* finally remove global app for good * test compilation fixes * fix races * fix deadlock * wake up write pump so it doesn't take forever to clean up
33 lines
1015 B
Go
33 lines
1015 B
Go
package app
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/mattermost/mattermost-server/model"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestRenameProviderDoCommand(t *testing.T) {
|
|
th := Setup().InitBasic()
|
|
defer th.TearDown()
|
|
|
|
rp := RenameProvider{}
|
|
args := &model.CommandArgs{
|
|
T: func(s string, args ...interface{}) string { return s },
|
|
ChannelId: th.BasicChannel.Id,
|
|
Session: model.Session{UserId: th.BasicUser.Id, TeamMembers: []*model.TeamMember{&model.TeamMember{TeamId: th.BasicTeam.Id, Roles: model.ROLE_TEAM_USER.Id}}},
|
|
}
|
|
|
|
// Blank text is a success
|
|
for msg, expected := range map[string]string{
|
|
"": "api.command_channel_rename.message.app_error",
|
|
"o": "api.command_channel_rename.too_short.app_error",
|
|
"joram": "",
|
|
"1234567890123456789012": "",
|
|
"12345678901234567890123": "api.command_channel_rename.too_long.app_error",
|
|
} {
|
|
actual := rp.DoCommand(th.App, args, msg).Text
|
|
assert.Equal(t, expected, actual)
|
|
}
|
|
}
|