diff options
Diffstat (limited to 'model/plugins_response_test.go')
-rw-r--r-- | model/plugins_response_test.go | 31 |
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)) +} |