From 2628022275ef64fde95545abe4634b4bd7177844 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 15 Sep 2017 08:51:46 -0400 Subject: PLT-7622 Improvements to server handling of webapp plugins (#7445) * Improvements to server handling of webapp plugins * Fix newline * Update manifest function names --- api4/plugin_test.go | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'api4/plugin_test.go') diff --git a/api4/plugin_test.go b/api4/plugin_test.go index f92e58ea0..9cedccfe7 100644 --- a/api4/plugin_test.go +++ b/api4/plugin_test.go @@ -17,14 +17,11 @@ import ( func TestPlugin(t *testing.T) { pluginDir, err := ioutil.TempDir("", "mm-plugin-test") require.NoError(t, err) - defer func() { - os.RemoveAll(pluginDir) - }() + defer os.RemoveAll(pluginDir) + webappDir, err := ioutil.TempDir("", "mm-webapp-test") require.NoError(t, err) - defer func() { - os.RemoveAll(webappDir) - }() + defer os.RemoveAll(webappDir) th := SetupEnterprise().InitBasic().InitSystemAdmin() defer TearDown() @@ -50,9 +47,7 @@ func TestPlugin(t *testing.T) { // Successful upload manifest, resp := th.SystemAdminClient.UploadPlugin(file) - defer func() { - os.RemoveAll("plugins/testplugin") - }() + defer os.RemoveAll("plugins/testplugin") CheckNoError(t, resp) assert.Equal(t, "testplugin", manifest.Id) @@ -91,6 +86,19 @@ func TestPlugin(t *testing.T) { _, resp = th.Client.GetPlugins() CheckForbiddenStatus(t, resp) + // Successful webapp get + manifests, resp = th.Client.GetWebappPlugins() + CheckNoError(t, resp) + + found = false + for _, m := range manifests { + if m.Id == manifest.Id { + found = true + } + } + + assert.True(t, found) + // Successful remove ok, resp := th.SystemAdminClient.RemovePlugin(manifest.Id) CheckNoError(t, resp) -- cgit v1.2.3-1-g7c22