MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / TestArgumentsInViolations

Method TestArgumentsInViolations

pkg/policies/policies_test.go:381–402  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

379}
380
381func (s *testSuite) TestArgumentsInViolations() {
382 schema := &v12.CraftingSchema{
383 Policies: &v12.Policies{
384 Attestation: []*v12.PolicyAttachment{
385 {
386 Policy: &v12.PolicyAttachment_Ref{Ref: "file://testdata/with_arguments.yaml"},
387 With: map[string]string{"email_array": "foobar@chainloop.dev"},
388 },
389 },
390 },
391 }
392
393 s.Run("arguments in violations", func() {
394 verifier := NewPolicyVerifier(schema.Policies, nil, &s.logger)
395 statement := loadStatement("testdata/statement.json", &s.Suite)
396
397 res, err := verifier.VerifyStatement(context.TODO(), statement)
398 s.NoError(err)
399 s.Len(res, 1)
400 s.Equal(map[string]string{"email_array": "foobar@chainloop.dev"}, res[0].GetWith())
401 })
402}
403
404func (s *testSuite) TestMaterialSelectionCriteria() {
405 attNoFilterPolicyTyped := &v12.PolicyAttachment{

Callers

nothing calls this directly

Calls 5

VerifyStatementMethod · 0.95
NewPolicyVerifierFunction · 0.85
loadStatementFunction · 0.85
RunMethod · 0.45
GetWithMethod · 0.45

Tested by

no test coverage detected