diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-08-29 05:48:38 -0400 |
---|---|---|
committer | Saturnino Abril <saturnino.abril@gmail.com> | 2017-08-29 17:48:38 +0800 |
commit | 82a8bd99cc5fe59fe4577c9b0d2c06a82c89e628 (patch) | |
tree | cfea354f60ce09ae143e46c52d0fb3460c61926c /app/command_channel_rename_test.go | |
parent | ce77d836fc7968f84041bc33587e54098b745357 (diff) | |
download | chat-82a8bd99cc5fe59fe4577c9b0d2c06a82c89e628.tar.gz chat-82a8bd99cc5fe59fe4577c9b0d2c06a82c89e628.tar.bz2 chat-82a8bd99cc5fe59fe4577c9b0d2c06a82c89e628.zip |
Enforce channel display name limits on slash command (#7309)
Diffstat (limited to 'app/command_channel_rename_test.go')
-rw-r--r-- | app/command_channel_rename_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/command_channel_rename_test.go b/app/command_channel_rename_test.go new file mode 100644 index 000000000..95a4f1500 --- /dev/null +++ b/app/command_channel_rename_test.go @@ -0,0 +1,31 @@ +package app + +import ( + "testing" + + "github.com/mattermost/platform/model" + "github.com/stretchr/testify/assert" +) + +func TestRenameProviderDoCommand(t *testing.T) { + th := Setup().InitBasic() + + 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(args, msg).Text + assert.Equal(t, expected, actual) + } +} |