Reuse utility function

This commit is contained in:
Michael Boulton 2020-08-14 16:22:43 +01:00
parent 7cb7fb1f08
commit 90e6540bdc
No known key found for this signature in database
GPG Key ID: 8A62CA0BE2E0197E
1 changed files with 2 additions and 2 deletions

View File

@ -241,13 +241,13 @@ func checkAllCommitsSigned(t *testing.T, entity *openpgp.Entity, repo *Repositor
func checkCommitSigned(t *testing.T, entity *openpgp.Entity, commit *Commit) error { func checkCommitSigned(t *testing.T, entity *openpgp.Entity, commit *Commit) error {
signature, signedData, err := commit.ExtractSignature() signature, signedData, err := commit.ExtractSignature()
if err != nil { if err != nil {
t.Logf("No signature on commit\n%s", commit.RawHeader()+"\n"+commit.RawMessage()) t.Logf("No signature on commit\n%s", commit.ContentToSign())
return err return err
} }
_, err = openpgp.CheckArmoredDetachedSignature(openpgp.EntityList{entity}, strings.NewReader(signedData), bytes.NewBufferString(signature)) _, err = openpgp.CheckArmoredDetachedSignature(openpgp.EntityList{entity}, strings.NewReader(signedData), bytes.NewBufferString(signature))
if err != nil { if err != nil {
t.Logf("Commit is not signed correctly\n%s", commit.RawHeader()+"\n"+commit.RawMessage()) t.Logf("Commit is not signed correctly\n%s", commit.ContentToSign())
return err return err
} }