MCPcopy
hub / github.com/perkeep/perkeep / TestSigner

Function TestSigner

pkg/schema/sign_test.go:29–53  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27)
28
29func TestSigner(t *testing.T) {
30 if testing.Short() {
31 t.Skip("skipping in short mode")
32 }
33 ent, err := jsonsign.NewEntity()
34 if err != nil {
35 t.Fatal(err)
36 }
37 armorPub, err := jsonsign.ArmoredPublicKey(ent)
38 if err != nil {
39 t.Fatal(err)
40 }
41 pubRef := blob.RefFromString(armorPub)
42 sig, err := NewSigner(pubRef, strings.NewReader(armorPub), ent)
43 if err != nil {
44 t.Fatalf("NewSigner: %v", err)
45 }
46 pn, err := NewUnsignedPermanode().Sign(ctxbg, sig)
47 if err != nil {
48 t.Fatalf("NewPermanode: %v", err)
49 }
50 if !strings.Contains(pn, `,"camliSig":"`) {
51 t.Errorf("Permanode doesn't look signed: %v", pn)
52 }
53}
54
55// TestClaimDate makes sure that when we sign a schema, we set the claimDate to
56// the time of the signature.

Callers

nothing calls this directly

Calls 9

NewEntityFunction · 0.92
ArmoredPublicKeyFunction · 0.92
RefFromStringFunction · 0.92
NewSignerFunction · 0.85
NewUnsignedPermanodeFunction · 0.85
FatalMethod · 0.80
ContainsMethod · 0.80
FatalfMethod · 0.65
SignMethod · 0.45

Tested by

no test coverage detected