Documentation ¶
Overview ¶
Package iamtest provides primitives for unit testing IAM implementations.
Index ¶
- func NewCaller(members ...string) *iamv1.Caller
- func WithMembers(ctx context.Context, members ...string) context.Context
- type Fixture
- type PermissionTester
- func (p *PermissionTester) Allow(member, permission string, resources ...string) *PermissionTester
- func (p *PermissionTester) AllowAll() *PermissionTester
- func (p *PermissionTester) Reset() *PermissionTester
- func (p *PermissionTester) TestPermissions(_ context.Context, caller *iamv1.Caller, resourcePermissions map[string]string) (map[string]bool, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Fixture ¶
type Fixture struct {
// contains filtered or unexported fields
}
Fixture is a test fixture with helper methods for IAM testing.
func NewFixture ¶
func NewFixture(server *iamspanner.IAMServer) *Fixture
NewFixture creates a new Fixture for the provided iamspanner.IAMServer.
type PermissionTester ¶ added in v0.38.0
type PermissionTester struct {
// contains filtered or unexported fields
}
PermissionTester is a mock permission tester.
func NewPermissionTester ¶ added in v0.38.0
func NewPermissionTester() *PermissionTester
NewPermissionTester creates a new mock permission tester.
func (*PermissionTester) Allow ¶ added in v0.38.0
func (p *PermissionTester) Allow(member, permission string, resources ...string) *PermissionTester
Allow a permission for a member and resource.
func (*PermissionTester) AllowAll ¶ added in v0.38.0
func (p *PermissionTester) AllowAll() *PermissionTester
AllowAll allows all testable permissions for all members and all resources.
func (*PermissionTester) Reset ¶ added in v0.38.0
func (p *PermissionTester) Reset() *PermissionTester
Reset all allowed permissions.
Click to show internal directories.
Click to hide internal directories.