Documentation
¶
Overview ¶
Package testvalidate provides shared validation test helpers used by both the top-level corpus tests and the x/exp/schema/validate corpus tests.
Index ¶
- func RunEntityChecks(t *testing.T, rs *resolved.Schema, entities cedar.EntityMap, cv Validation)
- func RunPolicyChecks(t *testing.T, rs *resolved.Schema, policySet *cedar.PolicySet, cv Validation)
- func RunRequestChecks(t *testing.T, rs *resolved.Schema, cv Validation, requests []cedar.Request)
- type PerEntityResult
- type PerPolicyResult
- type RequestValidationResult
- type Validation
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunEntityChecks ¶
RunEntityChecks runs aggregate and per-entity validation checks.
func RunPolicyChecks ¶
RunPolicyChecks runs aggregate and per-policy validation checks.
func RunRequestChecks ¶
RunRequestChecks runs per-request validation checks.
Types ¶
type PerEntityResult ¶
type PerEntityResult struct {
Errors []string `json:"errors"`
}
PerEntityResult holds expected per-entity validation results from Rust Cedar.
type PerPolicyResult ¶
type PerPolicyResult struct {
Strict bool `json:"strict"`
Permissive bool `json:"permissive"`
StrictErrors []string `json:"strictErrors"`
PermissiveErrors []string `json:"permissiveErrors"`
}
PerPolicyResult holds expected per-policy validation results from Rust Cedar.
type RequestValidationResult ¶
type RequestValidationResult struct {
Description string `json:"description"`
Strict *bool `json:"strict"`
Permissive *bool `json:"permissive"`
Errors []string `json:"errors"`
}
RequestValidationResult holds expected per-request validation results.
type Validation ¶
type Validation struct {
PolicyValidation struct {
Strict bool `json:"strict"`
Permissive bool `json:"permissive"`
StrictErrors []string `json:"strictErrors"`
PermissiveErrors []string `json:"permissiveErrors"`
PerPolicy map[string]PerPolicyResult `json:"perPolicy"`
} `json:"policyValidation"`
EntityValidation struct {
PerEntity map[string]PerEntityResult `json:"perEntity"`
} `json:"entityValidation"`
RequestValidation []RequestValidationResult `json:"requestValidation"`
}
Validation holds the full expected validation results from Rust Cedar.
func ParseValidation ¶
func ParseValidation(t testing.TB, data []byte) Validation
ParseValidation unmarshals validation JSON data into a Validation struct.