summaryrefslogtreecommitdiffstats
path: root/app/command_invite_test.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2018-10-01 13:51:12 +0100
committerGitHub <noreply@github.com>2018-10-01 13:51:12 +0100
commita0f75cadb2b0fa91f6e321b1b8b859519b2ec865 (patch)
tree49d6333eba0aa4cc02355a740c757500e9ee4798 /app/command_invite_test.go
parent71e3afaf63631583202f824424ced2e3aa02d140 (diff)
downloadchat-a0f75cadb2b0fa91f6e321b1b8b859519b2ec865.tar.gz
chat-a0f75cadb2b0fa91f6e321b1b8b859519b2ec865.tar.bz2
chat-a0f75cadb2b0fa91f6e321b1b8b859519b2ec865.zip
MM-12110: Don't /invite or /kick deactivated users. (#9494)
Diffstat (limited to 'app/command_invite_test.go')
-rw-r--r--app/command_invite_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/command_invite_test.go b/app/command_invite_test.go
index f141cb239..b48d3e13e 100644
--- a/app/command_invite_test.go
+++ b/app/command_invite_test.go
@@ -23,6 +23,8 @@ func TestInviteProvider(t *testing.T) {
basicUser3 := th.CreateUser()
th.LinkUserToTeam(basicUser3, th.BasicTeam)
basicUser4 := th.CreateUser()
+ deactivatedUser := th.CreateUser()
+ th.App.UpdateActive(deactivatedUser, false)
InviteP := InviteProvider{}
args := &model.CommandArgs{
@@ -38,6 +40,7 @@ func TestInviteProvider(t *testing.T) {
userAndPrivateChannel := "@" + th.BasicUser2.Username + " ~" + privateChannel.Name
userAndDMChannel := "@" + basicUser3.Username + " ~" + dmChannel.Name
userAndInvalidPrivate := "@" + basicUser3.Username + " ~" + privateChannel2.Name
+ deactivatedUserPublicChannel := "@" + deactivatedUser.Username + " ~" + channel.Name
tests := []struct {
desc string
@@ -99,6 +102,11 @@ func TestInviteProvider(t *testing.T) {
expected: "api.command_invite.private_channel.app_error",
msg: userAndInvalidPrivate,
},
+ {
+ desc: "try to add a deleted user to a public channel",
+ expected: "api.command_invite.missing_user.app_error",
+ msg: deactivatedUserPublicChannel,
+ },
}
for _, test := range tests {