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

Function TestMasterKey_retrievePubKey

pgp/keysource_test.go:556–574  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

554}
555
556func TestMasterKey_retrievePubKey(t *testing.T) {
557 t.Run("existing fingerprint", func(t *testing.T) {
558 key := NewMasterKeyFromFingerprint(mockFingerprint)
559 PubRing(mockPubRing).ApplyToMasterKey(key)
560
561 got, err := key.retrievePubKey()
562 assert.NoError(t, err)
563 assert.NotEmpty(t, got)
564 })
565
566 t.Run("non-existing fingerprint", func(t *testing.T) {
567 key := NewMasterKeyFromFingerprint("invalid")
568 PubRing(mockPubRing).ApplyToMasterKey(key)
569
570 got, err := key.retrievePubKey()
571 assert.Error(t, err)
572 assert.Empty(t, got)
573 })
574}
575
576func TestMasterKey_getPubRing(t *testing.T) {
577 t.Run("default pub ring", func(t *testing.T) {

Callers

nothing calls this directly

Calls 5

PubRingTypeAlias · 0.85
retrievePubKeyMethod · 0.80
ApplyToMasterKeyMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected