diff options
author | FurmanovD <39990503+FurmanovD@users.noreply.github.com> | 2018-09-17 13:46:06 +0300 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2018-09-17 11:46:06 +0100 |
commit | 517faccc332ce48de43e597d1b2d29a3961241e7 (patch) | |
tree | 38470bb23b9547b8efca92d3341dd023f5f2e999 /app/import_validators_test.go | |
parent | 35c148d2551bbb65a6d469b44876ba78578397c1 (diff) | |
download | chat-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_validators_test.go')
-rw-r--r-- | app/import_validators_test.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/app/import_validators_test.go b/app/import_validators_test.go index 5fb0518f7..617b5cd96 100644 --- a/app/import_validators_test.go +++ b/app/import_validators_test.go @@ -692,6 +692,25 @@ func TestImportValidateUserTeamsImportData(t *testing.T) { if err := validateUserTeamsImportData(&data); err != nil { t.Fatal("Should have succeeded with valid roles.") } + + // Valid (with JSON string of theme) + data[0].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"}`) + if err := validateUserTeamsImportData(&data); err != nil { + t.Fatal("Should have succeeded with valid theme.") + } + + // Invalid (invalid JSON string of theme) + data[0].Theme = ptrStr(`This is the invalid string which cannot be marshalled to JSON object :) + {"#DBBD4E","buttonBg", "#23A1FF", buttonColor`) + if err := validateUserTeamsImportData(&data); err == nil { + t.Fatal("Should have fail with invalid JSON string of theme.") + } + + // Invalid (valid JSON but invalid theme description) + data[0].Theme = ptrStr(`{"somekey": 25, "json_obj1": {"color": "#DBBD4E","buttonBg": "#23A1FF"}}`) + if err := validateUserTeamsImportData(&data); err == nil { + t.Fatal("Should have fail with valid JSON which contains invalid string of theme description.") + } + data[0].Theme = nil } func TestImportValidateUserChannelsImportData(t *testing.T) { |