mattermost/model/plugins_response_test.go
Chris daebd26a28
PLT-8018: Bundled jira plugin (#7920)
* bundled jira plugin

* fix generated file formatting, add prepackaged key

* whoops, uploaded wrong file

* whitelist generated files for license check

* make it work for people without go/bin in their path
2017-11-30 14:55:44 -06:00

31 lines
693 B
Go

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: []*PluginInfo{{Manifest: *manifest}},
Inactive: []*PluginInfo{},
}
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))
}