[MM 12458] Include user preferences in bulk export (#9784)
* First version of the preference exporter * First working version of the preference export * Removed useless debug line * Added special case of empty string to harverst the omitempty feature * Removed dangling line from rebase * Moved exportablepreference in scope * Fix go vet issue * Fix formating * Add simple test * Add full test for BulkExportUsers * Improve variable naming
Этот коммит содержится в:
коммит произвёл
George Goldberg
родитель
ee9395f1b6
Коммит
0f35c4b24d
@@ -1,14 +1,15 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mattermost/mattermost-server/model"
|
||||
"github.com/mattermost/mattermost-server/store"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestReactionsOfPost(t *testing.T) {
|
||||
@@ -164,3 +165,31 @@ func TestExportCustomEmoji(t *testing.T) {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestExportAllUsers(t *testing.T) {
|
||||
th1 := Setup().InitBasic()
|
||||
defer th1.TearDown()
|
||||
|
||||
var b bytes.Buffer
|
||||
err := th1.App.BulkExport(&b, "somefile", "somePath", "someDir")
|
||||
require.Nil(t, err)
|
||||
|
||||
th2 := Setup()
|
||||
defer th2.TearDown()
|
||||
err, i := th2.App.BulkImport(&b, false, 5)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 0, i)
|
||||
|
||||
users1, err := th1.App.GetUsers(&model.UserGetOptions{
|
||||
Page: 0,
|
||||
PerPage: 10,
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
users2, err := th2.App.GetUsers(&model.UserGetOptions{
|
||||
Page: 0,
|
||||
PerPage: 10,
|
||||
})
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, len(users1), len(users2))
|
||||
assert.ElementsMatch(t, users1, users2)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user