test

package
v0.31.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultIdentityType = api.IdentityType_IDENTITY_TYPE_SUB

	DefaultUsername      = "username"
	DefaultPolicyName    = "policyName"
	DefaultDecision      = "allowed"
	DefaultInstanceLabel = "label"

	OverridePolicyPath = "override.policy.path"
)

Variables

This section is empty.

Functions

func Decision

func Decision(authorize bool) *authz.Decision

func Policy

func Policy(path string) *middleware.Policy

func Request

func Request(o ...Override) *authz.IsRequest

Types

type Case

type Case struct {
	Name   string
	Client *mock.Authorizer
}

func NewTest

func NewTest(t *testing.T, name string, options *Options) *Case

type Options

type Options struct {
	ExpectedRequest *authz.IsRequest
	Reject          bool
	PolicyPath      string
}

func (*Options) HasPolicy

func (opts *Options) HasPolicy() bool

type Override

type Override func(*Overrides)

func Identity

func Identity(id string) Override

func IdentityType

func IdentityType(idtype api.IdentityType) Override

func PolicyInstanceLabel

func PolicyInstanceLabel(label string) Override

func PolicyName

func PolicyName(name string) Override

func PolicyPath

func PolicyPath(path string) Override

func Resource

func Resource(resource *structpb.Struct) Override

func WithDecision

func WithDecision(decision string) Override

type Overrides

type Overrides struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL