summaryrefslogtreecommitdiffstats
path: root/app/command_invite_test.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-05-11 17:20:47 +0200
committerDerrick Anderson <derrick@andersonwebstudio.com>2018-05-11 11:20:47 -0400
commit0dbaa2d032ae42cbf39945df12efb20fc572b559 (patch)
treef7562ffe4f32edd47b36849fd7b5c903d0075855 /app/command_invite_test.go
parent21d3b247d9645efa9471877cc36b46de92dc1d09 (diff)
downloadchat-0dbaa2d032ae42cbf39945df12efb20fc572b559.tar.gz
chat-0dbaa2d032ae42cbf39945df12efb20fc572b559.tar.bz2
chat-0dbaa2d032ae42cbf39945df12efb20fc572b559.zip
[MM-10458] Change system response to "Could not find the channel" - bug fix (#8738)
* [MM-10458] Change system response to "Could not find the channel" when trying to invite user to private channel you can't see * add another check to check if user have permission to add another in pvt channel
Diffstat (limited to 'app/command_invite_test.go')
-rw-r--r--app/command_invite_test.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/command_invite_test.go b/app/command_invite_test.go
index c46bc4628..0d1db4a07 100644
--- a/app/command_invite_test.go
+++ b/app/command_invite_test.go
@@ -18,6 +18,7 @@ func TestInviteProvider(t *testing.T) {
channel := th.createChannel(th.BasicTeam, model.CHANNEL_OPEN)
privateChannel := th.createChannel(th.BasicTeam, model.CHANNEL_PRIVATE)
dmChannel := th.CreateDmChannel(th.BasicUser2)
+ privateChannel2 := th.createChannelWithAnotherUser(th.BasicTeam, model.CHANNEL_PRIVATE, th.BasicUser2.Id)
basicUser3 := th.CreateUser()
th.LinkUserToTeam(basicUser3, th.BasicTeam)
@@ -36,6 +37,7 @@ func TestInviteProvider(t *testing.T) {
userAndDisplayChannel := "@" + th.BasicUser2.Username + " ~" + channel.DisplayName + " "
userAndPrivateChannel := "@" + th.BasicUser2.Username + " ~" + privateChannel.Name
userAndDMChannel := "@" + basicUser3.Username + " ~" + dmChannel.Name
+ userAndInvalidPrivate := "@" + basicUser3.Username + " ~" + privateChannel2.Name
tests := []struct {
desc string
@@ -97,6 +99,11 @@ func TestInviteProvider(t *testing.T) {
expected: "api.command_invite.directchannel.app_error",
msg: userAndDMChannel,
},
+ {
+ desc: "try to add a user to a privante channel with no permission",
+ expected: "api.command_invite.private_channel.app_error",
+ msg: userAndInvalidPrivate,
+ },
}
for _, test := range tests {