added missing tests

This commit is contained in:
Nico von Geyso 2012-05-30 08:32:13 +02:00
parent e402d0e9eb
commit eb62331b36
2 changed files with 8 additions and 2 deletions

@ -162,7 +162,7 @@ Repository_head(Repository *self)
{
git_reference *head;
const git_oid *oid;
int err, len;
int err;
err = git_repository_head(&head, self->repo);
if(err < 0) {

@ -35,18 +35,24 @@ import os
from os.path import join, realpath
from pygit2 import GIT_OBJ_ANY, GIT_OBJ_BLOB, GIT_OBJ_COMMIT, init_repository, \
discover_repository
discover_repository, Commit
from . import utils
__author__ = 'dborowitz@google.com (Dave Borowitz)'
HEAD_SHA = '5fe808e8953c12735680c257f56600cb0de44b10'
A_HEX_SHA = 'af431f20fc541ed6d5afede3e2dc7160f6f01f16'
A_BIN_SHA = binascii.unhexlify(A_HEX_SHA.encode('ascii'))
class RepositoryTest(utils.BareRepoTestCase):
def test_head(self):
head = self.repo.head
self.assertTrue(HEAD_SHA, head.hex)
self.assertTrue(type(head), Commit)
def test_read(self):
self.assertRaises(TypeError, self.repo.read, 123)
self.assertRaisesWithArg(KeyError, '1' * 40, self.repo.read, '1' * 40)