[MM-56400] Allow mmctl to download a Support Packet using --local mode (#25836)

Этот коммит содержится в:
Ben Schumacher
2024-02-26 07:55:54 +01:00
коммит произвёл GitHub
родитель e9b9d4ff60
Коммит 1c0dcda801
2 изменённых файлов: 13 добавлений и 8 удалений

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

@@ -211,16 +211,18 @@ func TestGenerateSupportPacket(t *testing.T) {
th.LoginSystemManager()
defer th.TearDown()
t.Run("As a System Administrator", func(t *testing.T) {
t.Run("system admin and local client can generate support packet", func(t *testing.T) {
l := model.NewTestLicense()
th.App.Srv().SetLicense(l)
file, _, err := th.SystemAdminClient.GenerateSupportPacket(context.Background())
require.NoError(t, err)
require.NotZero(t, len(file))
th.TestForSystemAdminAndLocal(t, func(t *testing.T, c *model.Client4) {
file, _, err := th.SystemAdminClient.GenerateSupportPacket(context.Background())
require.NoError(t, err)
require.NotZero(t, len(file))
})
})
t.Run("As a System Administrator but with RestrictSystemAdmin true", func(t *testing.T) {
t.Run("Using system admin and local client but with RestrictSystemAdmin true", func(t *testing.T) {
originalRestrictSystemAdminVal := *th.App.Config().ExperimentalSettings.RestrictSystemAdmin
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ExperimentalSettings.RestrictSystemAdmin = true })
defer func() {
@@ -229,9 +231,11 @@ func TestGenerateSupportPacket(t *testing.T) {
})
}()
_, resp, err := th.SystemAdminClient.GenerateSupportPacket(context.Background())
require.Error(t, err)
CheckForbiddenStatus(t, resp)
th.TestForSystemAdminAndLocal(t, func(t *testing.T, c *model.Client4) {
_, resp, err := th.SystemAdminClient.GenerateSupportPacket(context.Background())
require.Error(t, err)
CheckForbiddenStatus(t, resp)
})
})
t.Run("As a system role, not system admin", func(t *testing.T) {