Skip to content
This repository has been archived by the owner on Sep 11, 2020. It is now read-only.

Commit

Permalink
test: add TestVerify for commit
Browse files Browse the repository at this point in the history
  • Loading branch information
darkowlzz committed Nov 22, 2017
1 parent 23f45e9 commit 4b92aab
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions plumbing/object/commit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,3 +296,60 @@ func (s *SuiteCommit) TestStat(c *C) {
c.Assert(fileStats[1].Deletion, Equals, 0)
c.Assert(fileStats[1].String(), Equals, " php/crappy.php | 259 ++++++++++++++++++++++++++++++++++++++++++++++++++++\n")
}

func (s *SuiteCommit) TestVerify(c *C) {
ts, err := time.Parse(time.RFC3339, "2017-11-20T22:31:55+05:30")
c.Assert(err, IsNil)
commit := &Commit{
Author: Signature{Name: "Sunny", Email: "[email protected]", When: ts},
Committer: Signature{Name: "Sunny", Email: "[email protected]", When: ts},
Message: "some commit message",
PGPSignature: `-----BEGIN PGP SIGNATURE-----
iQEzBAABCAAdFiEEoRt6IzxHaZkkUslhQyLeMqcmyU4FAloVzUkACgkQQyLeMqcm
yU6gyQgApqyfvKOkffSIXf2S4XpJa4mUTrinLV56RQqSBkUy16BDQSSvuVNtVg4K
c113WyXg30SB1j4+mm21uKg9g9M7e26f/JweGL7uNzD6XEKNd1D2aoFmWHRHsJrc
BEKHNFomValjmKfxHRaoysM4VdTbGO79gjCXPy/3LfHqjzh7SmiD9oUhOJK6rZod
Qs2q5ZOxw0bdk0msITCX1XsP/P5LABnEmvaB2o3YHTWcT0WEQ7bzslgqWIgbmTfu
zlKPMZ/dtX2KLobr8dHg7QF46F2bTWOQQatjWMV4zKDWeolCVJbLPGW1TYk+K0fO
16j1oXeal6Hk8PXasljamGfkkNDr4w==
=nEby
-----END PGP SIGNATURE-----`,
}

armoredKeyRing := string(`
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQENBFmtHgABCADnfThM7q8D4pgUub9jMppSpgFh3ev84g3Csc3yQUlszEO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jHyw5dZgZe8XLrG84BIfbG0Hj8PjrFdF1D
Czt9bk+PbYAnLORW2oX1oedxVrNFo5UrbWgBSjA1ppbGFjwSDHFlyjuEuxqyFwAR
AQABiQE8BBgBCAAmFiEEoRt6IzxHaZkkUslhQyLeMqcmyU4FAlmtHgACGwwFCQPC
ZwAACgkQQyLeMqcmyU7ZBggArzc8UUVSjde987Vqnu/S5Cv8Qhz+UB7gAFyTW2iF
VYvB86r30H/NnfjvjCVkBE6FHCNHoxWVyDWmuxKviB7nkReHuwqniQHPgdJDcTKC
tBboeX2IYBLJbEvEJuz5NSvnvFuYkIpZHqySFaqdl/qu9XcmoPL5AmIzIFOeiNty
qT0ldkf3ru6yQQDDqBDpkfz4AzkpFnLYL59z6IbJDK2Hz7aKeSEeVOGiZLCjIZZV
uISZThYqh5zUkvF346OHLDqfDdgQ4RZriqd/DTtRJPlz2uL0QcEIjJuYCkG0UWgl
sYyf9RfOnw/KUFAQbdtvLx3ikODQC+D3KBtuKI9ISHQfgw==
=FPev
-----END PGP PUBLIC KEY BLOCK-----
`)

_, err = commit.Verify(armoredKeyRing)
c.Assert(err, IsNil)
}

0 comments on commit 4b92aab

Please sign in to comment.