clienttest

package
v0.0.0-...-c2efb00 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package clienttest defines a TargetHandler and Templates, and Constraints for documenting and testing the behavior of Client.

The intent is a minimal working example of a TargetHandler which fully utilizes the logic within Client, and documents how these components are intended to interact.

Further, this provides example ConstraintTemplates and Constraints.

Index

Constants

View Source
const (
	KindAllow            = "Allow"
	KindDeny             = "Deny"
	KindDenyPrint        = "DenyPrint"
	KindDenyImport       = "DenyImport"
	KindCheckData        = "CheckData"
	KindRuntimeError     = "RuntimeError"
	KindForbidDuplicates = "ForbidDuplicates"
	KindFuture           = "Future"
)
View Source
const ModuleAllow = `
package foo

violation[{"msg": msg}] {
  false
  msg := "denied"
}
`

ModuleAllow defines a Rego package which allows all objects it reviews.

View Source
const ModuleDeny = `
package foo

violation[{"msg": msg}] {
  true
  msg := "denied"
}
`

ModuleDeny defines a Rego package which denies all objects it reviews.

Variables

This section is empty.

Functions

func KindCheckDataNumbered

func KindCheckDataNumbered(i int) string

func New

func New(t testing.TB, opts ...client.Opt) *client.Client

New constructs a new Client for testing with a default-constructed local driver and no other Backend opts.

func TemplateAllow

func TemplateAllow() *templates.ConstraintTemplate

func TemplateCheckData

func TemplateCheckData() *templates.ConstraintTemplate

func TemplateCheckDataNumbered

func TemplateCheckDataNumbered(i int) *templates.ConstraintTemplate

func TemplateDeny

func TemplateDeny() *templates.ConstraintTemplate

func TemplateDenyImport

func TemplateDenyImport() *templates.ConstraintTemplate

TemplateDenyImport returns a ConstraintTemplate which rejects all incoming objects and relies on a library to do so.

func TemplateDenyPrint

func TemplateDenyPrint() *templates.ConstraintTemplate

func TemplateForbidDuplicates

func TemplateForbidDuplicates() *templates.ConstraintTemplate

func TemplateFuture

func TemplateFuture() *templates.ConstraintTemplate

func TemplateRuntimeError

func TemplateRuntimeError() *templates.ConstraintTemplate

Types

This section is empty.

Directories

Path Synopsis
Package cts is a set of methods for constructing ConstraintTemplates for use in tests.
Package cts is a set of methods for constructing ConstraintTemplates for use in tests.

Jump to

Keyboard shortcuts

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