Fix various unit tests (#10079)
* fix spurious TestMuteCommandSpecificChannel test failure See https://community-daily.mattermost.com/core/pl/px9p8s3dzbg1pf3ddrm5cr36uw * fix race in TestExportUserChannels * TestExportUserChannels: remove SaveMember call, as it is redundant and used to be silently failing anyway
Этот коммит содержится в:
коммит произвёл
Harrison Healey
родитель
343a1d67e9
Коммит
66d174d80b
@@ -1790,7 +1790,7 @@ func (a *App) ToggleMuteChannel(channelId string, userId string) *model.ChannelM
|
||||
member.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP] = model.CHANNEL_NOTIFY_MENTION
|
||||
}
|
||||
|
||||
a.Srv.Store.Channel().UpdateMember(member)
|
||||
<-a.Srv.Store.Channel().UpdateMember(member)
|
||||
return member
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,6 @@ func TestMuteCommandSpecificChannel(t *testing.T) {
|
||||
UserId: th.BasicUser.Id,
|
||||
}, channel2.Name)
|
||||
assert.Equal(t, "api.command_mute.success_mute", resp.Text)
|
||||
time.Sleep(time.Millisecond)
|
||||
channel2M, _ = th.App.GetChannelMember(channel2.Id, th.BasicUser.Id)
|
||||
assert.Equal(t, model.CHANNEL_NOTIFY_MENTION, channel2M.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP])
|
||||
|
||||
@@ -111,7 +110,6 @@ func TestMuteCommandSpecificChannel(t *testing.T) {
|
||||
}, "~"+channel2.Name)
|
||||
|
||||
assert.Equal(t, "api.command_mute.success_unmute", resp.Text)
|
||||
time.Sleep(time.Millisecond)
|
||||
channel2M, _ = th.App.GetChannelMember(channel2.Id, th.BasicUser.Id)
|
||||
assert.Equal(t, model.CHANNEL_NOTIFY_ALL, channel2M.NotifyProps[model.MARK_UNREAD_NOTIFY_PROP])
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/store"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
@@ -78,12 +79,7 @@ func TestExportUserChannels(t *testing.T) {
|
||||
}
|
||||
var preferences model.Preferences
|
||||
preferences = append(preferences, preference)
|
||||
channelMember := model.ChannelMember{
|
||||
ChannelId: channel.Id,
|
||||
UserId: user.Id,
|
||||
}
|
||||
th.App.Srv.Store.Channel().SaveMember(&channelMember)
|
||||
th.App.Srv.Store.Preference().Save(&preferences)
|
||||
store.Must(th.App.Srv.Store.Preference().Save(&preferences))
|
||||
th.App.UpdateChannelMemberNotifyProps(notifyProps, channel.Id, user.Id)
|
||||
exportData, err := th.App.buildUserChannelMemberships(user.Id, team.Id)
|
||||
require.Nil(t, err)
|
||||
|
||||
Ссылка в новой задаче
Block a user