github.com/vmware/govmomi@v0.51.0/simulator/authorization_manager_test.go (about)

     1  // © Broadcom. All Rights Reserved.
     2  // The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries.
     3  // SPDX-License-Identifier: Apache-2.0
     4  
     5  package simulator
     6  
     7  import (
     8  	"testing"
     9  
    10  	"github.com/vmware/govmomi/simulator/vpx"
    11  	"github.com/vmware/govmomi/vim25/types"
    12  )
    13  
    14  func TestAuthorizationManager(t *testing.T) {
    15  	for i := 0; i < 2; i++ {
    16  		model := VPX()
    17  		ctx := NewContext()
    18  		_ = New(NewServiceInstance(ctx, model.ServiceContent, model.RootFolder)) // 2nd pass panics w/o copying RoleList
    19  
    20  		authz := ctx.Map.Get(*vpx.ServiceContent.AuthorizationManager).(*AuthorizationManager)
    21  		authz.RemoveAuthorizationRole(&types.RemoveAuthorizationRole{
    22  			RoleId: -2, // ReadOnly
    23  		})
    24  	}
    25  }