summaryrefslogtreecommitdiffstats
path: root/app/import_functions_test.go
diff options
context:
space:
mode:
authorFurmanovD <39990503+FurmanovD@users.noreply.github.com>2018-09-17 13:46:06 +0300
committerGeorge Goldberg <george@gberg.me>2018-09-17 11:46:06 +0100
commit517faccc332ce48de43e597d1b2d29a3961241e7 (patch)
tree38470bb23b9547b8efca92d3341dd023f5f2e999 /app/import_functions_test.go
parent35c148d2551bbb65a6d469b44876ba78578397c1 (diff)
downloadchat-517faccc332ce48de43e597d1b2d29a3961241e7.tar.gz
chat-517faccc332ce48de43e597d1b2d29a3961241e7.tar.bz2
chat-517faccc332ce48de43e597d1b2d29a3961241e7.zip
MM-11424 Extend bulk import to support themes across teams(#9305) (#9419)
* MM-11424 Extend bulk import to support themes across teams(#9305) Also added: Advanced Settings: +'feature_enabled_markdown_preview' +'formatting' Sidebar Settings: +'show_unread_section' * MM-11424 (PR review) user teams' theme validator test updated * MM-11424 (PR review) added test with valid JSON of invalid theme(by structure) JSON string contains numeric and JSON object fields, not just a correct "string":"string" map
Diffstat (limited to 'app/import_functions_test.go')
-rw-r--r--app/import_functions_test.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/import_functions_test.go b/app/import_functions_test.go
index 10b1d5587..c76915ac6 100644
--- a/app/import_functions_test.go
+++ b/app/import_functions_test.go
@@ -1016,6 +1016,7 @@ func TestImportImportUser(t *testing.T) {
data.Teams = &[]UserTeamImportData{
{
Name: &teamName,
+ Theme: ptrStr(`{"awayIndicator":"#DBBD4E","buttonBg":"#23A1FF","buttonColor":"#FFFFFF","centerChannelBg":"#ffffff","centerChannelColor":"#333333","codeTheme":"github","image":"/static/files/a4a388b38b32678e83823ef1b3e17766.png","linkColor":"#2389d7","mentionBg":"#2389d7","mentionColor":"#ffffff","mentionHighlightBg":"#fff2bb","mentionHighlightLink":"#2f81b7","newMessageSeparator":"#FF8800","onlineIndicator":"#7DBE00","sidebarBg":"#fafafa","sidebarHeaderBg":"#3481B9","sidebarHeaderTextColor":"#ffffff","sidebarText":"#333333","sidebarTextActiveBorder":"#378FD2","sidebarTextActiveColor":"#111111","sidebarTextHoverBg":"#e6f2fa","sidebarUnreadText":"#333333","type":"Mattermost"}`),
Roles: ptrStr("team_user team_admin"),
Channels: &[]UserChannelImportData{
{
@@ -1049,6 +1050,7 @@ func TestImportImportUser(t *testing.T) {
}
checkPreference(t, th.App, user.Id, model.PREFERENCE_CATEGORY_FAVORITE_CHANNEL, channel.Id, "true")
+ checkPreference(t, th.App, user.Id, model.PREFERENCE_CATEGORY_THEME, team.Id, *(*data.Teams)[0].Theme)
// No more new member objects.
if tmc, err := th.App.GetTeamMembers(team.Id, 0, 1000); err != nil {
@@ -1074,6 +1076,9 @@ func TestImportImportUser(t *testing.T) {
MessageDisplay: ptrStr("compact"),
ChannelDisplayMode: ptrStr("centered"),
TutorialStep: ptrStr("3"),
+ UseMarkdownPreview: ptrStr("true"),
+ UseFormatting: ptrStr("true"),
+ ShowUnreadSection: ptrStr("true"),
}
if err := th.App.ImportUser(&data, false); err != nil {
t.Fatalf("Should have succeeded.")
@@ -1091,6 +1096,9 @@ func TestImportImportUser(t *testing.T) {
checkPreference(t, th.App, user.Id, model.PREFERENCE_CATEGORY_DISPLAY_SETTINGS, "message_display", *data.MessageDisplay)
checkPreference(t, th.App, user.Id, model.PREFERENCE_CATEGORY_DISPLAY_SETTINGS, "channel_display_mode", *data.ChannelDisplayMode)
checkPreference(t, th.App, user.Id, model.PREFERENCE_CATEGORY_TUTORIAL_STEPS, user.Id, *data.TutorialStep)
+ checkPreference(t, th.App, user.Id, model.PREFERENCE_CATEGORY_ADVANCED_SETTINGS, "feature_enabled_markdown_preview", *data.UseMarkdownPreview)
+ checkPreference(t, th.App, user.Id, model.PREFERENCE_CATEGORY_ADVANCED_SETTINGS, "formatting", *data.UseFormatting)
+ checkPreference(t, th.App, user.Id, model.PREFERENCE_CATEGORY_SIDEBAR_SETTINGS, "show_unread_section", *data.ShowUnreadSection)
// Change those preferences.
data = UserImportData{