MCPcopy
hub / github.com/getsops/sops / TestUnencryptedCommentRegexFail

Function TestUnencryptedCommentRegexFail

sops_test.go:620–637  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

618}
619
620func TestUnencryptedCommentRegexFail(t *testing.T) {
621 branches := TreeBranches{
622 TreeBranch{
623 TreeItem{
624 Key: Comment{Value: "sops:noenc"},
625 Value: nil,
626 },
627 TreeItem{
628 Key: "foo",
629 Value: "bar",
630 },
631 },
632 }
633 tree := Tree{Branches: branches, Metadata: Metadata{UnencryptedCommentRegex: "ENC"}}
634 cipher := encPrefixCipher{}
635 _, err := tree.Encrypt(bytes.Repeat([]byte("f"), 32), cipher)
636 assert.ErrorContains(t, err, "Encrypted comment \"ENC:sops:noenc\" matches UnencryptedCommentRegex!")
637}
638
639type MockCipher struct{}
640

Callers

nothing calls this directly

Calls 1

EncryptMethod · 0.95

Tested by

no test coverage detected