[MM-45769] Properly initialize the request.Context for imports and tests (#20659)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
ae482e6214
Коммит
cb6cee1883
@@ -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,
|
||||
|
||||
Ссылка в новой задаче
Block a user