package authz

import "github.com/open-policy-agent/opa/test/authz"

Deprecated: This package is intended for older projects transitioning from OPA v0.x and will remain for the lifetime of OPA v1.x, but its use is not recommended. For newer features and behaviours, such as defaulting to the Rego v1 syntax, use the corresponding components in the github.com/open-policy-agent/opa/v1 package instead. See https://www.openpolicyagent.org/docs/latest/v0-compatibility/ for more information.

Package authz contains unit and benchmark tests for authz use-cases The public (non-test) APIs are meant to be used as helpers for other tests to build off of.

Index

Constants

const (
	ForbidIdentity = v1.ForbidIdentity
	ForbidPath     = v1.ForbidPath
	ForbidMethod   = v1.ForbidMethod
	Allow          = v1.Allow
)

InputMode types supported by GenerateInput

const AllowQuery = v1.AllowQuery

AllowQuery is the test query that goes with the Policy defined in this package

const Policy = v1.Policy

Policy is a test rego policy for a token based authz system

Functions

func GenerateDataset

func GenerateDataset(profile DataSetProfile) map[string]any

GenerateDataset will generate a dataset for the given DatasetProfile

func GenerateInput

func GenerateInput(profile DataSetProfile, mode InputMode) (any, any)

GenerateInput will use a dataset profile and desired InputMode to generate inputs for testing

Types

type DataSetProfile

type DataSetProfile = v1.DataSetProfile

DataSetProfile defines how the test data should be generated

type InputMode

type InputMode = v1.InputMode

InputMode defines what type of inputs to generate for testings

Source Files

doc.go testing.go

Version
v1.5.1 (latest)
Published
Jun 4, 2025
Platform
js/wasm
Imports
1 packages
Last checked
1 minute ago

Tools for package owners.