Files
mostlymatter/api4/cluster_test.go
Adarsh K Kumar cacdda702e MM-19663 | Migrate brand_test and cluster_test to testify (#12935)
* MM-19663 | Migrate brand_test and cluster_test to testify

* Use require.Fail instead of require.FailNow

Co-Authored-By: Ben Schumacher <ben.schumacher@mattermost.com>
2019-11-03 17:13:22 +02:00

36 строки
906 B
Go

// Copyright (c) 2017-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
package api4
import (
"testing"
"github.com/mattermost/mattermost-server/model"
"github.com/stretchr/testify/require"
)
func TestGetClusterStatus(t *testing.T) {
th := Setup().InitBasic()
defer th.TearDown()
t.Run("as system user", func(t *testing.T) {
_, resp := th.Client.GetClusterStatus()
CheckForbiddenStatus(t, resp)
})
t.Run("as system admin", func(t *testing.T) {
infos, resp := th.SystemAdminClient.GetClusterStatus()
CheckNoError(t, resp)
require.NotNil(t, infos, "cluster status should not be nil")
})
t.Run("as restricted system admin", func(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ExperimentalSettings.RestrictSystemAdmin = true })
_, resp := th.SystemAdminClient.GetClusterStatus()
CheckForbiddenStatus(t, resp)
})
}