Skip to content

Commit

Permalink
Fixup validator_test
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanmeier5 committed Aug 9, 2022
1 parent db3e9c7 commit 08465ab
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pkg/providers/vsphere/validator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package vsphere

import (
"context"
"encoding/json"
"testing"

"github.com/golang/mock/gomock"
Expand All @@ -26,15 +27,15 @@ func TestValidatorValidatePrivs(t *testing.T) {
},
}

ret := []string{
"ContentLibrary.AddLibraryItem",
"ContentLibrary.CheckInTemplate",
var privs []string
err := json.Unmarshal([]byte(vsphereAdminPrivsFile), &privs)
if err != nil {
t.Fatalf("failed to validate privs: %v", err)
}
vsc.EXPECT().Username().Return("foobar")
vsc.EXPECT().Username().Return("foobar")
vsc.EXPECT().GetPrivsOnEntity(ctx, networkPath, vsphereTypeNetwork, "foobar").Return(ret, nil)
vsc.EXPECT().GetPrivsOnEntity(ctx, networkPath, vsphereTypeNetwork, "foobar").Return(privs, nil)

err := v.validatePrivs(ctx, objects, vsc)
err = v.validatePrivs(ctx, objects, vsc)
if err != nil {
t.Fatalf("failed to validate privs: %v", err)
}
Expand Down

0 comments on commit 08465ab

Please sign in to comment.