summaryrefslogtreecommitdiffstats
path: root/model/manifest_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/manifest_test.go')
-rw-r--r--model/manifest_test.go96
1 files changed, 95 insertions, 1 deletions
diff --git a/model/manifest_test.go b/model/manifest_test.go
index 1ec43a217..3f174d3a7 100644
--- a/model/manifest_test.go
+++ b/model/manifest_test.go
@@ -1,3 +1,6 @@
+// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
package model
import (
@@ -64,6 +67,25 @@ func TestManifestUnmarshal(t *testing.T) {
Webapp: &ManifestWebapp{
BundlePath: "thebundlepath",
},
+ SettingsSchema: &PluginSettingsSchema{
+ Header: "theheadertext",
+ Footer: "thefootertext",
+ Settings: map[string]*PluginSetting{
+ "thesetting": &PluginSetting{
+ DisplayName: "thedisplayname",
+ Type: PLUGIN_CONFIG_TYPE_DROPDOWN,
+ HelpText: "thehelptext",
+ RegenerateHelpText: "theregeneratehelptext",
+ Options: []*PluginOption{
+ &PluginOption{
+ DisplayName: "theoptiondisplayname",
+ Value: "thevalue",
+ },
+ },
+ Default: "thedefault",
+ },
+ },
+ },
}
var yamlResult Manifest
@@ -73,6 +95,19 @@ backend:
executable: theexecutable
webapp:
bundle_path: thebundlepath
+settings_schema:
+ header: theheadertext
+ footer: thefootertext
+ settings:
+ thesetting:
+ display_name: thedisplayname
+ type: dropdown
+ help_text: thehelptext
+ regenerate_help_text: theregeneratehelptext
+ options:
+ - display_name: theoptiondisplayname
+ value: thevalue
+ default: thedefault
`), &yamlResult))
assert.Equal(t, expected, yamlResult)
@@ -84,7 +119,26 @@ webapp:
},
"webapp": {
"bundle_path": "thebundlepath"
- }
+ },
+ "settings_schema": {
+ "header": "theheadertext",
+ "footer": "thefootertext",
+ "settings": {
+ "thesetting": {
+ "display_name": "thedisplayname",
+ "type": "dropdown",
+ "help_text": "thehelptext",
+ "regenerate_help_text": "theregeneratehelptext",
+ "options": [
+ {
+ "display_name": "theoptiondisplayname",
+ "value": "thevalue"
+ }
+ ],
+ "default": "thedefault"
+ }
+ }
+ }
}`), &jsonResult))
assert.Equal(t, expected, jsonResult)
}
@@ -115,6 +169,25 @@ func TestManifestJson(t *testing.T) {
Webapp: &ManifestWebapp{
BundlePath: "thebundlepath",
},
+ SettingsSchema: &PluginSettingsSchema{
+ Header: "theheadertext",
+ Footer: "thefootertext",
+ Settings: map[string]*PluginSetting{
+ "thesetting": &PluginSetting{
+ DisplayName: "thedisplayname",
+ Type: PLUGIN_CONFIG_TYPE_DROPDOWN,
+ HelpText: "thehelptext",
+ RegenerateHelpText: "theregeneratehelptext",
+ Options: []*PluginOption{
+ &PluginOption{
+ DisplayName: "theoptiondisplayname",
+ Value: "thevalue",
+ },
+ },
+ Default: "thedefault",
+ },
+ },
+ },
}
json := manifest.ToJson()
@@ -159,6 +232,25 @@ func TestManifestClientManifest(t *testing.T) {
Webapp: &ManifestWebapp{
BundlePath: "thebundlepath",
},
+ SettingsSchema: &PluginSettingsSchema{
+ Header: "theheadertext",
+ Footer: "thefootertext",
+ Settings: map[string]*PluginSetting{
+ "thesetting": &PluginSetting{
+ DisplayName: "thedisplayname",
+ Type: PLUGIN_CONFIG_TYPE_DROPDOWN,
+ HelpText: "thehelptext",
+ RegenerateHelpText: "theregeneratehelptext",
+ Options: []*PluginOption{
+ &PluginOption{
+ DisplayName: "theoptiondisplayname",
+ Value: "thevalue",
+ },
+ },
+ Default: "thedefault",
+ },
+ },
+ },
}
sanitized := manifest.ClientManifest()
@@ -166,6 +258,7 @@ func TestManifestClientManifest(t *testing.T) {
assert.NotEmpty(t, sanitized.Id)
assert.NotEmpty(t, sanitized.Version)
assert.NotEmpty(t, sanitized.Webapp)
+ assert.NotEmpty(t, sanitized.SettingsSchema)
assert.Empty(t, sanitized.Name)
assert.Empty(t, sanitized.Description)
assert.Empty(t, sanitized.Backend)
@@ -176,4 +269,5 @@ func TestManifestClientManifest(t *testing.T) {
assert.NotEmpty(t, manifest.Name)
assert.NotEmpty(t, manifest.Description)
assert.NotEmpty(t, manifest.Backend)
+ assert.NotEmpty(t, manifest.SettingsSchema)
}