forked from libgit2/libgit2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit: add failing tests for object checking for git_commit_with_sig…
…nature There can be a significant difference between the system where we created the buffer (if at all) and when the caller provides us with the contents of a commit. Provide some test cases (we have to adapt the existing ones because they refer to trees and commits which do not exist).
- Loading branch information
Showing
1 changed file
with
32 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,19 +299,43 @@ void test_commit_write__can_validate_objects(void) | |
cl_git_fail(create_commit_from_ids(&commit_id, &tree_id, &parent_id)); | ||
} | ||
|
||
void test_commit_write__attach_singleline_signature(void) | ||
void test_commit_write__attach_signature_checks_objects(void) | ||
{ | ||
const char *sig = "magic word: pretty please"; | ||
const char *badtree = "tree 6b79e22d69bf46e289df0345a14ca059dfc9bdf6\n\ | ||
parent 34734e478d6cf50c27c9d69026d93974d052c454\n\ | ||
author Ben Burkert <[email protected]> 1358451456 -0800\n\ | ||
committer Ben Burkert <[email protected]> 1358451456 -0800\n\ | ||
\n\ | ||
a simple commit which does not work\n"; | ||
|
||
const char *data = "tree 6b79e22d69bf46e289df0345a14ca059dfc9bdf6\n\ | ||
const char *badparent = "tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\n\ | ||
parent 34734e478d6cf50c27c9d69026d93974d052c454\n\ | ||
author Ben Burkert <[email protected]> 1358451456 -0800\n\ | ||
committer Ben Burkert <[email protected]> 1358451456 -0800\n\ | ||
\n\ | ||
a simple commit which does not work\n"; | ||
|
||
git_oid id; | ||
|
||
cl_git_fail_with(-1, git_commit_create_with_signature(&id, g_repo, badtree, sig, "magicsig")); | ||
cl_git_fail_with(-1, git_commit_create_with_signature(&id, g_repo, badparent, sig, "magicsig")); | ||
|
||
} | ||
|
||
void test_commit_write__attach_singleline_signature(void) | ||
{ | ||
const char *sig = "magic word: pretty please"; | ||
|
||
const char *data = "tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\n\ | ||
parent 8496071c1b46c854b31185ea97743be6a8774479\n\ | ||
author Ben Burkert <[email protected]> 1358451456 -0800\n\ | ||
committer Ben Burkert <[email protected]> 1358451456 -0800\n\ | ||
\n\ | ||
a simple commit which works\n"; | ||
|
||
const char *complete = "tree 6b79e22d69bf46e289df0345a14ca059dfc9bdf6\n\ | ||
parent 34734e478d6cf50c27c9d69026d93974d052c454\n\ | ||
const char *complete = "tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\n\ | ||
parent 8496071c1b46c854b31185ea97743be6a8774479\n\ | ||
author Ben Burkert <[email protected]> 1358451456 -0800\n\ | ||
committer Ben Burkert <[email protected]> 1358451456 -0800\n\ | ||
magicsig magic word: pretty please\n\ | ||
|
@@ -352,15 +376,15 @@ cpxtDQQMGYFpXK/71stq\n\ | |
=ozeK\n\ | ||
-----END PGP SIGNATURE-----"; | ||
|
||
const char *data = "tree 6b79e22d69bf46e289df0345a14ca059dfc9bdf6\n\ | ||
parent 34734e478d6cf50c27c9d69026d93974d052c454\n\ | ||
const char *data = "tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\n\ | ||
parent 8496071c1b46c854b31185ea97743be6a8774479\n\ | ||
author Ben Burkert <[email protected]> 1358451456 -0800\n\ | ||
committer Ben Burkert <[email protected]> 1358451456 -0800\n\ | ||
\n\ | ||
a simple commit which works\n"; | ||
|
||
const char *complete = "tree 6b79e22d69bf46e289df0345a14ca059dfc9bdf6\n\ | ||
parent 34734e478d6cf50c27c9d69026d93974d052c454\n\ | ||
const char *complete = "tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904\n\ | ||
parent 8496071c1b46c854b31185ea97743be6a8774479\n\ | ||
author Ben Burkert <[email protected]> 1358451456 -0800\n\ | ||
committer Ben Burkert <[email protected]> 1358451456 -0800\n\ | ||
gpgsig -----BEGIN PGP SIGNATURE-----\n\ | ||
|