test

package
v0.34.4 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: MIT Imports: 6 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultIdentityType = api.IdentityType_IDENTITY_TYPE_SUB

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

	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 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