MM-21898 - Part 1: Generate and use an interface instead of *A… (#13840)

* Generate and use an interface instead of *App
Этот коммит содержится в:
Eli Yukelzon
2020-02-13 13:26:58 +01:00
коммит произвёл GitHub
родитель 66fc096768
Коммит 17523fa5d9
200 изменённых файлов: 4553 добавлений и 2361 удалений

Просмотреть файл

@@ -88,13 +88,13 @@ func TestCheckPendingNotifications(t *testing.T) {
},
}
channelMember, err := th.App.Srv.Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
channelMember, err := th.App.Srv().Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
require.Nil(t, err)
channelMember.LastViewedAt = 9999999
_, err = th.App.Srv.Store.Channel().UpdateMember(channelMember)
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
require.Nil(t, err)
err = th.App.Srv.Store.Preference().Save(&model.Preferences{{
err = th.App.Srv().Store.Preference().Save(&model.Preferences{{
UserId: th.BasicUser.Id,
Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS,
Name: model.PREFERENCE_NAME_EMAIL_INTERVAL,
@@ -109,10 +109,10 @@ func TestCheckPendingNotifications(t *testing.T) {
require.Len(t, job.pendingNotifications[th.BasicUser.Id], 1, "shouldn't have sent queued post")
// test that notifications are cleared if the user has acted
channelMember, err = th.App.Srv.Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
channelMember, err = th.App.Srv().Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
require.Nil(t, err)
channelMember.LastViewedAt = 10001000
_, err = th.App.Srv.Store.Channel().UpdateMember(channelMember)
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
require.Nil(t, err)
job.checkPendingNotifications(time.Unix(10002, 0), func(string, []*batchedNotification) {})
@@ -186,10 +186,10 @@ func TestCheckPendingNotificationsDefaultInterval(t *testing.T) {
job := NewEmailBatchingJob(th.Server, 128)
// bypasses recent user activity check
channelMember, err := th.App.Srv.Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
channelMember, err := th.App.Srv().Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
require.Nil(t, err)
channelMember.LastViewedAt = 9999000
_, err = th.App.Srv.Store.Channel().UpdateMember(channelMember)
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
require.Nil(t, err)
job.pendingNotifications[th.BasicUser.Id] = []*batchedNotification{
@@ -224,14 +224,14 @@ func TestCheckPendingNotificationsCantParseInterval(t *testing.T) {
job := NewEmailBatchingJob(th.Server, 128)
// bypasses recent user activity check
channelMember, err := th.App.Srv.Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
channelMember, err := th.App.Srv().Store.Channel().GetMember(th.BasicChannel.Id, th.BasicUser.Id)
require.Nil(t, err)
channelMember.LastViewedAt = 9999000
_, err = th.App.Srv.Store.Channel().UpdateMember(channelMember)
_, err = th.App.Srv().Store.Channel().UpdateMember(channelMember)
require.Nil(t, err)
// preference value is not an integer, so we'll fall back to the default 15min value
err = th.App.Srv.Store.Preference().Save(&model.Preferences{{
err = th.App.Srv().Store.Preference().Save(&model.Preferences{{
UserId: th.BasicUser.Id,
Category: model.PREFERENCE_CATEGORY_NOTIFICATIONS,
Name: model.PREFERENCE_NAME_EMAIL_INTERVAL,