summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2018-04-05 08:53:01 -0400
committerDerrick Anderson <derrick@andersonwebstudio.com>2018-04-05 08:53:01 -0400
commit715a7f893dc4a855083331333629cb50528a030d (patch)
treea6e499972bf7563c371bd94ac0420a9e3cae52ba
parentfb45087545f0c33765fedd191a7907683cd0a467 (diff)
downloadchat-715a7f893dc4a855083331333629cb50528a030d.tar.gz
chat-715a7f893dc4a855083331333629cb50528a030d.tar.bz2
chat-715a7f893dc4a855083331333629cb50528a030d.zip
Remove problematic mute test (#8580)
-rw-r--r--api/command_mute_test.go114
1 files changed, 0 insertions, 114 deletions
diff --git a/api/command_mute_test.go b/api/command_mute_test.go
deleted file mode 100644
index 6b2dad944..000000000
--- a/api/command_mute_test.go
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
-// See License.txt for license information.
-
-package api
-
-import (
- "strings"
- "testing"
-
- "github.com/mattermost/mattermost-server/model"
- "github.com/nicksnyder/go-i18n/i18n"
-)
-
-func TestMuteCommand(t *testing.T) {
- th := Setup().InitBasic()
- defer th.TearDown()
-
- i18n.MustLoadTranslationFile("../i18n/en.json")
- T, _ := i18n.Tfunc("en")
-
- // Create client and users
- Client := th.BasicClient
- team := th.BasicTeam
- user1 := Client.Must(Client.GetMe("")).Data.(*model.User)
- user2 := th.BasicUser2
-
- // Mute channel1 directly with '/mute'
- channel1 := &model.Channel{DisplayName: "AA", Name: "aa" + model.NewId() + "a", Type: model.CHANNEL_OPEN, TeamId: team.Id}
- channel1 = Client.Must(Client.CreateChannel(channel1)).Data.(*model.Channel)
- Client.Must(Client.JoinChannel(channel1.Id))
-
- channel1M := Client.Must(Client.GetChannelMember(channel1.Id, user1.Id)).Data.(*model.ChannelMember)
- if channel1M.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_NOTIFY_MENTION {
- t.Fatal("channel shouldn't be muted on initial setup")
- }
-
- rs := Client.Must(Client.Command(channel1.Id, "/mute")).Data.(*model.CommandResponse)
- if !strings.EqualFold(rs.Text, T("api.command_mute.success_mute", map[string]interface{}{"Channel": channel1.DisplayName})) {
- t.Fatal("failed to mute channel")
- }
-
- channel1M = Client.Must(Client.GetChannelMember(channel1.Id, user1.Id)).Data.(*model.ChannelMember)
- if channel1M.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_NOTIFY_ALL {
- t.Fatal("channel should be muted")
- }
-
- rs = Client.Must(Client.Command(channel1.Id, "/mute")).Data.(*model.CommandResponse)
- if !strings.EqualFold(rs.Text, T("api.command_mute.success_unmute", map[string]interface{}{"Channel": channel1.DisplayName})) {
- t.Fatal("failed to mute channel")
- }
-
- channel1M = Client.Must(Client.GetChannelMember(channel1.Id, user1.Id)).Data.(*model.ChannelMember)
- if channel1M.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_NOTIFY_MENTION {
- t.Fatal("channel shouldn't be muted anymore")
- }
-
- // Mute channel2 via channel1 with chan-handle '/mute ~aa'
- channel2 := &model.Channel{DisplayName: "BB", Name: "bb" + model.NewId() + "a", Type: model.CHANNEL_PRIVATE, TeamId: team.Id}
- channel2 = Client.Must(Client.CreateChannel(channel2)).Data.(*model.Channel)
- Client.Must(Client.JoinChannel(channel2.Id))
- Client.Must(Client.AddChannelMember(channel2.Id, user2.Id))
-
- channel2M := Client.Must(Client.GetChannelMember(channel2.Id, user1.Id)).Data.(*model.ChannelMember)
- if channel2M.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_NOTIFY_MENTION {
- t.Fatal("channel shouldn't be muted on initial setup")
- }
-
- rs = Client.Must(Client.Command(channel1.Id, "/mute ~" + channel2.Name)).Data.(*model.CommandResponse)
- if !strings.EqualFold(rs.Text, T("api.command_mute.success_mute", map[string]interface{}{"Channel": channel2.DisplayName})) {
- t.Fatal("failed to mute channel")
- }
-
- channel2M = Client.Must(Client.GetChannelMember(channel2.Id, user1.Id)).Data.(*model.ChannelMember)
- if channel2M.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_NOTIFY_ALL {
- t.Fatal("channel should be muted")
- }
-
- rs = Client.Must(Client.Command(channel1.Id, "/mute ~" + channel2.Name)).Data.(*model.CommandResponse)
- if !strings.EqualFold(rs.Text, T("api.command_mute.success_unmute", map[string]interface{}{"Channel": channel2.DisplayName})) {
- t.Fatal("failed to mute channel")
- }
-
- channel2M = Client.Must(Client.GetChannelMember(channel2.Id, user1.Id)).Data.(*model.ChannelMember)
- if channel2M.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_NOTIFY_MENTION {
- t.Fatal("channel shouldn't be muted anymore")
- }
-
- // Mute direct message
- channel3 := Client.Must(Client.CreateDirectChannel(user2.Id)).Data.(*model.Channel)
- channel3M := Client.Must(Client.GetChannelMember(channel3.Id, user1.Id)).Data.(*model.ChannelMember)
- if channel3M.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_NOTIFY_MENTION {
- t.Fatal("channel shouldn't be muted on initial setup")
- }
-
- rs = Client.Must(Client.Command(channel3.Id, "/mute")).Data.(*model.CommandResponse)
- if !strings.EqualFold(rs.Text, T("api.command_mute.success_mute_direct_msg")) {
- t.Fatal("failed to mute channel")
- }
-
- channel3M = Client.Must(Client.GetChannelMember(channel3.Id, user1.Id)).Data.(*model.ChannelMember)
- if channel3M.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_NOTIFY_ALL {
- t.Fatal("channel should be muted")
- }
-
- rs = Client.Must(Client.Command(channel3.Id, "/mute")).Data.(*model.CommandResponse)
- if !strings.EqualFold(rs.Text, T("api.command_mute.success_unmute_direct_msg")) {
- t.Fatal("failed to mute channel")
- }
-
- channel3M = Client.Must(Client.GetChannelMember(channel3.Id, user1.Id)).Data.(*model.ChannelMember)
- if channel3M.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] == model.CHANNEL_NOTIFY_MENTION {
- t.Fatal("channel shouldn't be muted anymore")
- }
-}