FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Add tests for extractSignature · nodegit/nodegit@15fa398 · GitHub

Repository navigation

Commit 15fa398

Browse files
committed
Add tests for extractSignature
1 parent 9a89c82 commit 15fa398

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

‎test/tests/commit.js‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,4 +718,43 @@ describe("Commit", function() {
718718
// the self-freeing signature should get freed
719719
assert.equal(startSelfFreeingCount, endSelfFreeingCount);
720720
});
721+
722+
describe("Commit's Signature", function() {
723+
it.only("Can retrieve the gpg signature from a commit", function() {
724+
var expectedSignedData =
725+
"tree f4661419a6fbbe865f78644fec722c023ce4b65f\n" +
726+
"parent 32789a79e71fbc9e04d3eff7425e1771eb595150\n" +
727+
"author Tyler Ang-Wanek <tylerw@axosoft.com> 1521227848 -0700\n" +
728+
"committer Tyler Ang-Wanek <tylerw@axosoft.com> 1521227848 -0700\n\n" +
729+
"GPG Signed commit\n";
730+
731+
var expectedSignature =
732+
"-----BEGIN PGP SIGNATURE-----\n\n" +
733+
"iQEcBAABCAAGBQJarBhIAAoJEE8pfTd/81lKQA4IAL8Mu5kc4B/MX9s4XB26Ahap\n" +
734+
"n06kCx3RQ1KHMZIRomAjCnb48WieNVuy1y+Ut0RgfCxxrJ1ZnzFG3kF2bIKwIxNI\n" +
735+
"tYIC76iWny+mrVnb2mjKYjn/3F4c4VJGENq9ITiV1WeE4yJ8dHw2ox2D+hACzTvQ\n" +
736+
"KVroedk8BDFJxS6DFb20To35xbAVhwBnAGRcII4Wi5PPMFpqAhGLfq3Czv95ddSz\n" +
737+
"BHlyp27+YWSpV0Og0dqOEhsdDYaPrOBGRcoRiqjue+l5tgK/QerLFZ4aovZzpuEP\n" +
738+
"Xx1yZfqXIiy4Bo40qScSrdnmnp/kMq/NQGR3jYU+SleFHVKNFsya9UwurMaezY0=\n" +
739+
"=eZzi\n-----END PGP SIGNATURE-----";
740+
741+
return NodeGit.Commit.lookup(
742+
this.repository,
743+
"cc1401eaac4e9e77190e98a9353b305f0c6313d8"
744+
)
745+
.then(function(commit) {
746+
return commit.getSignature();
747+
})
748+
.then(function(extractSignature) {
749+
assert.equal(
750+
extractSignature.signature,
751+
expectedSignature
752+
);
753+
assert.equal(
754+
extractSignature.signedData,
755+
expectedSignedData
756+
);
757+
});
758+
});
759+
});
721760
});

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL