summaryrefslogtreecommitdiffstats
path: root/api4/apitestlib.go
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2018-07-10 15:01:43 -0400
committerJoramWilander <jwawilander@gmail.com>2018-07-10 15:01:43 -0400
commit6c7dc2d29ccac5f9925402f6be1a4c2a3c46c005 (patch)
tree5564a47257bf6e85aaef711980c5b0fcb4d07dcc /api4/apitestlib.go
parentc042ffa460296587579aff54b157a5109e022f7e (diff)
parent1e1a5e5e85240f25c4faddcb24c5a29a915fe6e4 (diff)
downloadchat-6c7dc2d29ccac5f9925402f6be1a4c2a3c46c005.tar.gz
chat-6c7dc2d29ccac5f9925402f6be1a4c2a3c46c005.tar.bz2
chat-6c7dc2d29ccac5f9925402f6be1a4c2a3c46c005.zip
Merge branch 'plugins-2'
Diffstat (limited to 'api4/apitestlib.go')
-rw-r--r--api4/apitestlib.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/api4/apitestlib.go b/api4/apitestlib.go
index 8293a03f7..ff7d47b26 100644
--- a/api4/apitestlib.go
+++ b/api4/apitestlib.go
@@ -49,6 +49,7 @@ type TestHelper struct {
SystemAdminClient *model.Client4
SystemAdminUser *model.User
+ tempWorkspace string
}
type persistentTestStore struct {
@@ -137,6 +138,25 @@ func setupTestHelper(enterprise bool) *TestHelper {
th.Client = th.CreateClient()
th.SystemAdminClient = th.CreateClient()
+
+ if th.tempWorkspace == "" {
+ dir, err := ioutil.TempDir("", "apptest")
+ if err != nil {
+ panic(err)
+ }
+ th.tempWorkspace = dir
+ }
+
+ pluginDir := filepath.Join(th.tempWorkspace, "plugins")
+ webappDir := filepath.Join(th.tempWorkspace, "webapp")
+
+ th.App.UpdateConfig(func(cfg *model.Config) {
+ *cfg.PluginSettings.Directory = pluginDir
+ *cfg.PluginSettings.ClientDirectory = webappDir
+ })
+
+ th.App.InitPlugins(pluginDir, webappDir)
+
return th
}