Doug Lauder
2023-03-22 17:22:27 -04:00
коммит произвёл GitHub
родитель b61c096497
Коммит c943ed6859
13276 изменённых файлов: 1695615 добавлений и 223189 удалений

Просмотреть файл

@@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/mattermost/mattermost-server/v6/model"
"github.com/mattermost/mattermost-server/v6/server/platform/shared/mlog"
)
func TestAvailablePlugins(t *testing.T) {
@@ -21,8 +22,10 @@ func TestAvailablePlugins(t *testing.T) {
os.RemoveAll(dir)
})
testLogger, _ := mlog.NewLogger()
env := Environment{
pluginDir: dir,
logger: testLogger,
}
t.Run("Should be able to load available plugins", func(t *testing.T) {
@@ -70,4 +73,26 @@ func TestAvailablePlugins(t *testing.T) {
require.NoError(t, err)
require.Len(t, bundles, 0)
})
t.Run("Should not load bundles on blocklist", func(t *testing.T) {
bundle := model.BundleInfo{
Manifest: &model.Manifest{
Id: "playbooks",
Version: "1",
},
}
err := os.Mkdir(filepath.Join(dir, "plugin4"), 0700)
require.NoError(t, err)
defer os.RemoveAll(filepath.Join(dir, "plugin4"))
path := filepath.Join(dir, "plugin4", "plugin.json")
manifestJSON, jsonErr := json.Marshal(bundle.Manifest)
require.NoError(t, jsonErr)
err = os.WriteFile(path, manifestJSON, 0644)
require.NoError(t, err)
bundles, err := env.Available()
require.NoError(t, err)
require.Len(t, bundles, 0)
})
}