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
- func KindCheckDataNumbered(i int) string
- func New(t testing.TB, opts ...client.Opt) *client.Client
- func TemplateAllow() *templates.ConstraintTemplate
- func TemplateCheckData() *templates.ConstraintTemplate
- func TemplateCheckDataNumbered(i int) *templates.ConstraintTemplate
- func TemplateDeny() *templates.ConstraintTemplate
- func TemplateDenyImport() *templates.ConstraintTemplate
- func TemplateDenyPrint() *templates.ConstraintTemplate
- func TemplateForbidDuplicates() *templates.ConstraintTemplate
- func TemplateFuture() *templates.ConstraintTemplate
- func TemplateRuntimeError() *templates.ConstraintTemplate
Constants ¶
const ( KindAllow = "Allow" KindDeny = "Deny" KindDenyPrint = "DenyPrint" KindDenyImport = "DenyImport" KindCheckData = "CheckData" KindRuntimeError = "RuntimeError" KindForbidDuplicates = "ForbidDuplicates" KindFuture = "Future" )
const ModuleAllow = `
package foo
violation[{"msg": msg}] {
false
msg := "denied"
}
`
ModuleAllow defines a Rego package which allows all objects it reviews.
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 New ¶
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.