From a0f75cadb2b0fa91f6e321b1b8b859519b2ec865 Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Mon, 1 Oct 2018 13:51:12 +0100 Subject: MM-12110: Don't /invite or /kick deactivated users. (#9494) --- app/command_invite_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'app/command_invite_test.go') 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 { -- cgit v1.2.3-1-g7c22