[MM-35863] Add IsEnterpriseReady Plugin API (#18676)

Automatic Merge
Этот коммит содержится в:
Joe
2021-10-20 11:12:58 +01:00
коммит произвёл GitHub
родитель 5928e4f9e0
Коммит dea8610f1e
6 изменённых файлов: 72 добавлений и 0 удалений

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

@@ -13,6 +13,7 @@ import (
"net/http"
"net/url"
"path/filepath"
"strconv"
"strings"
"github.com/mattermost/mattermost-server/v6/app/request"
@@ -141,6 +142,11 @@ func (api *PluginAPI) GetLicense() *model.License {
return api.app.Srv().License()
}
func (api *PluginAPI) IsEnterpriseReady() bool {
result, _ := strconv.ParseBool(model.BuildEnterpriseReady)
return result
}
func (api *PluginAPI) GetServerVersion() string {
return model.CurrentVersion
}

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

@@ -1922,3 +1922,15 @@ func TestPluginAPIUpdateCommand(t *testing.T) {
require.Equal(t, team1.Id, newCmd4.TeamId)
}
func TestPluginAPIIsEnterpriseReady(t *testing.T) {
oldValue := model.BuildEnterpriseReady
defer func() { model.BuildEnterpriseReady = oldValue }()
model.BuildEnterpriseReady = "true"
th := Setup(t)
defer th.TearDown()
api := th.SetupPluginAPI()
assert.Equal(t, true, api.IsEnterpriseReady())
}