summaryrefslogtreecommitdiffstats
path: root/api/channel_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-06-04 10:52:25 -0400
committerJoram Wilander <jwawilander@gmail.com>2016-06-04 10:52:25 -0400
commit971149d2b298b3408af7218c868ed0b3edd83c2e (patch)
tree86e082c9341ccd98bc6bf5894ce3ee7d14359550 /api/channel_test.go
parent8d09c58b4dbfd9f9ad651e03263dc109d7680a47 (diff)
downloadchat-971149d2b298b3408af7218c868ed0b3edd83c2e.tar.gz
chat-971149d2b298b3408af7218c868ed0b3edd83c2e.tar.bz2
chat-971149d2b298b3408af7218c868ed0b3edd83c2e.zip
Don't allow users to be added to a channel they are not in the team of (#3246)
Diffstat (limited to 'api/channel_test.go')
-rw-r--r--api/channel_test.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/api/channel_test.go b/api/channel_test.go
index b2bb56952..175b0a14a 100644
--- a/api/channel_test.go
+++ b/api/channel_test.go
@@ -749,6 +749,7 @@ func TestAddChannelMember(t *testing.T) {
Client := th.BasicClient
team := th.BasicTeam
user2 := th.BasicUser2
+ user3 := th.CreateUser(Client)
channel1 := &model.Channel{DisplayName: "A Test API Name", Name: "a" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
@@ -790,6 +791,9 @@ func TestAddChannelMember(t *testing.T) {
t.Fatal("Should have errored, channel deleted")
}
+ if _, err := Client.AddChannelMember(channel1.Id, user3.Id); err == nil {
+ t.Fatal("Should have errored, user not on team")
+ }
}
func TestRemoveChannelMember(t *testing.T) {