summaryrefslogtreecommitdiffstats
path: root/api/channel_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-12-20 09:27:29 -0500
committerChristopher Speller <crspeller@gmail.com>2016-12-20 09:27:29 -0500
commit1f67c91fcec746aeeb34b9c39b7df328d5f6a4a0 (patch)
tree5e89cf3867369e75d89dd95069c458be75c0d51c /api/channel_test.go
parentbf3fec604fc4ad0fd53d38490c18d872bccd629d (diff)
downloadchat-1f67c91fcec746aeeb34b9c39b7df328d5f6a4a0.tar.gz
chat-1f67c91fcec746aeeb34b9c39b7df328d5f6a4a0.tar.bz2
chat-1f67c91fcec746aeeb34b9c39b7df328d5f6a4a0.zip
Prevent accidental removal of user from town square (#4842)
Diffstat (limited to 'api/channel_test.go')
-rw-r--r--api/channel_test.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/api/channel_test.go b/api/channel_test.go
index 25e7b6a28..683deb8a9 100644
--- a/api/channel_test.go
+++ b/api/channel_test.go
@@ -1344,6 +1344,11 @@ func TestRemoveChannelMember(t *testing.T) {
t.Fatal("Should have errored, channel deleted")
}
+ townSquare := Client.Must(Client.GetChannelByName("town-square")).Data.(*model.Channel)
+
+ if _, err := Client.RemoveChannelMember(townSquare.Id, userStd.Id); err == nil {
+ t.Fatal("should have errored, channel is default")
+ }
}
func TestUpdateNotifyProps(t *testing.T) {
@@ -1684,8 +1689,13 @@ func TestGetChannelByName(t *testing.T) {
th := Setup().InitBasic()
Client := th.BasicClient
- if _, err := Client.GetChannelByName(th.BasicChannel.Name); err != nil {
+ if result, err := Client.GetChannelByName(th.BasicChannel.Name); err != nil {
t.Fatal("Failed to get channel")
+ } else {
+ channel := result.Data.(*model.Channel)
+ if channel.Name != th.BasicChannel.Name {
+ t.Fatal("channel names did not match")
+ }
}
if _, err := Client.GetChannelByName("InvalidChannelName"); err == nil {
@@ -1703,6 +1713,6 @@ func TestGetChannelByName(t *testing.T) {
Client.Login(user2.Email, "passwd1")
if _, err := Client.GetChannelByName(th.BasicChannel.Name); err == nil {
- t.Fatal("Should fail due not enough permissions")
+ t.Fatal("Should fail due to not enough permissions")
}
}