Migrate Overwrite and GetMaxPostSize() in PostStore to sync by default (#10829)
* Migrate Overwrite and GetMaxPostSize() in PostStore to sync by default * GH-10762: fix return type for mock func * GH-10762: fix tests for MaxPostSize() mocks * fix imports
Этот коммит содержится в:
@@ -14,7 +14,6 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/store"
|
||||
"github.com/mattermost/mattermost-server/store/storetest"
|
||||
)
|
||||
|
||||
@@ -565,25 +564,21 @@ func TestMaxPostSize(t *testing.T) {
|
||||
Description string
|
||||
StoreMaxPostSize int
|
||||
ExpectedMaxPostSize int
|
||||
ExpectedError *model.AppError
|
||||
}{
|
||||
{
|
||||
"error fetching max post size",
|
||||
"Max post size less than model.model.POST_MESSAGE_MAX_RUNES_V1 ",
|
||||
0,
|
||||
model.POST_MESSAGE_MAX_RUNES_V1,
|
||||
model.NewAppError("TestMaxPostSize", "this is an error", nil, "", http.StatusBadRequest),
|
||||
},
|
||||
{
|
||||
"4000 rune limit",
|
||||
4000,
|
||||
4000,
|
||||
nil,
|
||||
},
|
||||
{
|
||||
"16383 rune limit",
|
||||
16383,
|
||||
16383,
|
||||
nil,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -595,12 +590,7 @@ func TestMaxPostSize(t *testing.T) {
|
||||
mockStore := &storetest.Store{}
|
||||
defer mockStore.AssertExpectations(t)
|
||||
|
||||
mockStore.PostStore.On("GetMaxPostSize").Return(
|
||||
storetest.NewStoreChannel(store.StoreResult{
|
||||
Data: testCase.StoreMaxPostSize,
|
||||
Err: testCase.ExpectedError,
|
||||
}),
|
||||
)
|
||||
mockStore.PostStore.On("GetMaxPostSize").Return(testCase.StoreMaxPostSize)
|
||||
|
||||
app := App{
|
||||
Srv: &Server{
|
||||
|
||||
Ссылка в новой задаче
Block a user