summaryrefslogtreecommitdiffstats
path: root/app/plugin_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'app/plugin_test.go')
-rw-r--r--app/plugin_test.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/plugin_test.go b/app/plugin_test.go
index 4794d2704..9ad5dc1fa 100644
--- a/app/plugin_test.go
+++ b/app/plugin_test.go
@@ -4,8 +4,10 @@
package app
import (
+ "errors"
"net/http"
"net/http/httptest"
+ "strings"
"testing"
"github.com/gorilla/mux"
@@ -195,3 +197,26 @@ func TestPluginCommands(t *testing.T) {
require.NotNil(t, err)
assert.Equal(t, http.StatusNotFound, err.StatusCode)
}
+
+type pluginBadActivation struct {
+ testPlugin
+}
+
+func (p *pluginBadActivation) OnActivate(api plugin.API) error {
+ return errors.New("won't activate for some reason")
+}
+
+func TestPluginBadActivation(t *testing.T) {
+ th := Setup().InitBasic()
+ defer th.TearDown()
+
+ th.InstallPlugin(&model.Manifest{
+ Id: "foo",
+ }, &pluginBadActivation{})
+
+ t.Run("EnablePlugin bad activation", func(t *testing.T) {
+ err := th.App.EnablePlugin("foo")
+ assert.NotNil(t, err)
+ assert.True(t, strings.Contains(err.DetailedError, "won't activate for some reason"))
+ })
+}