summaryrefslogtreecommitdiffstats
path: root/model/plugins_response_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-10-25 08:17:17 -0400
committerGitHub <noreply@github.com>2017-10-25 08:17:17 -0400
commit16b845c0d77535ea306339f7a8bd22fc72f8a3c5 (patch)
treee768b8d1ca5cc3f2e55207ea73c5954b37f708ed /model/plugins_response_test.go
parent9c0575ce6ef662c18ad7eb91bf6084c6fac1b7ae (diff)
downloadchat-16b845c0d77535ea306339f7a8bd22fc72f8a3c5.tar.gz
chat-16b845c0d77535ea306339f7a8bd22fc72f8a3c5.tar.bz2
chat-16b845c0d77535ea306339f7a8bd22fc72f8a3c5.zip
Differentiate between installed and activated states for plugins (#7706)
Diffstat (limited to 'model/plugins_response_test.go')
-rw-r--r--model/plugins_response_test.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/model/plugins_response_test.go b/model/plugins_response_test.go
new file mode 100644
index 000000000..9129c68f7
--- /dev/null
+++ b/model/plugins_response_test.go
@@ -0,0 +1,31 @@
+package model
+
+import (
+ "strings"
+ "testing"
+
+ "github.com/stretchr/testify/assert"
+)
+
+func TestPluginsResponseJson(t *testing.T) {
+ manifest := &Manifest{
+ Id: "theid",
+ Backend: &ManifestBackend{
+ Executable: "theexecutable",
+ },
+ Webapp: &ManifestWebapp{
+ BundlePath: "thebundlepath",
+ },
+ }
+
+ response := &PluginsResponse{
+ Active: []*Manifest{manifest},
+ Inactive: []*Manifest{},
+ }
+
+ json := response.ToJson()
+ newResponse := PluginsResponseFromJson(strings.NewReader(json))
+ assert.Equal(t, newResponse, response)
+ assert.Equal(t, newResponse.ToJson(), json)
+ assert.Equal(t, PluginsResponseFromJson(strings.NewReader("junk")), (*PluginsResponse)(nil))
+}