Files
mattermost/model/plugins_response_test.go
Jesse Hallam 309a3dda60 Support server, deprecate backend in plugin manifest (#9127)
* Support `server`, deprecate `backend` in plugin manifest

This lets us converge on the use of the term `server` everywhere instead
of sometimes `backend` and sometimes `server`. We're still using
`webapp` and will eventually support `mobile` as well.

The plan is actually to rip out these deprecations as part of releasing
5.2, but I want to coordinate the extra additional breakage at the same
time, so for now this is a backwards compatible change.

* fix failing tests
2018-07-18 15:32:33 -07:00

32 lines
691 B
Go

package model
import (
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
func TestPluginsResponseJson(t *testing.T) {
manifest := &Manifest{
Id: "theid",
Server: &ManifestServer{
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))
}