[MM-45769] Properly initialize the request.Context for imports and tests (#20659)

Этот коммит содержится в:
Tim Scheuermann
2022-07-18 11:58:06 +03:00
коммит произвёл GitHub
родитель ae482e6214
Коммит cb6cee1883
9 изменённых файлов: 13 добавлений и 16 удалений

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

@@ -14,7 +14,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/v6/app/request"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/store/storetest/mocks"
)
@@ -720,7 +719,7 @@ func TestNoticeFetch(t *testing.T) {
require.Nil(t, appErr)
// get them for specified user
messages, appErr := th.App.GetProductNotices(&request.Context{}, th.BasicUser.Id, th.BasicTeam.Id, model.NoticeClientTypeAll, "1.2.3", "en")
messages, appErr := th.App.GetProductNotices(th.Context, th.BasicUser.Id, th.BasicTeam.Id, model.NoticeClientTypeAll, "1.2.3", "en")
require.Nil(t, appErr)
require.Len(t, messages, 1)
@@ -729,7 +728,7 @@ func TestNoticeFetch(t *testing.T) {
require.Nil(t, appErr)
// get them again, see that none are returned
messages, appErr = th.App.GetProductNotices(&request.Context{}, th.BasicUser.Id, th.BasicTeam.Id, model.NoticeClientTypeAll, "1.2.3", "en")
messages, appErr = th.App.GetProductNotices(th.Context, th.BasicUser.Id, th.BasicTeam.Id, model.NoticeClientTypeAll, "1.2.3", "en")
require.Nil(t, appErr)
require.Len(t, messages, 0)
@@ -748,7 +747,7 @@ func TestNoticeFetch(t *testing.T) {
require.Nil(t, appErr)
// get them again, since conditions don't match we should be zero
messages, appErr = th.App.GetProductNotices(&request.Context{}, th.BasicUser.Id, th.BasicTeam.Id, model.NoticeClientTypeAll, "1.2.3", "en")
messages, appErr = th.App.GetProductNotices(th.Context, th.BasicUser.Id, th.BasicTeam.Id, model.NoticeClientTypeAll, "1.2.3", "en")
require.Nil(t, appErr)
require.Len(t, messages, 0)

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

@@ -81,7 +81,7 @@ func setupTestHelper(s store.Store, includeCacheLayer bool, tb testing.TB) *Test
},
wh: &mockWebHub{},
},
Context: &request.Context{},
Context: request.EmptyContext(nil),
configStore: configStore,
dbStore: s,
LogBuffer: buffer,

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

@@ -96,7 +96,7 @@ func setupTestHelper(s store.Store, includeCacheLayer bool, tb testing.TB) *Test
},
},
},
Context: &request.Context{},
Context: request.EmptyContext(nil),
configStore: configStore,
dbStore: s,
LogBuffer: buffer,