added missing tests
This commit is contained in:
parent
e402d0e9eb
commit
eb62331b36
@ -162,7 +162,7 @@ Repository_head(Repository *self)
|
|||||||
{
|
{
|
||||||
git_reference *head;
|
git_reference *head;
|
||||||
const git_oid *oid;
|
const git_oid *oid;
|
||||||
int err, len;
|
int err;
|
||||||
|
|
||||||
err = git_repository_head(&head, self->repo);
|
err = git_repository_head(&head, self->repo);
|
||||||
if(err < 0) {
|
if(err < 0) {
|
||||||
|
@ -35,18 +35,24 @@ import os
|
|||||||
from os.path import join, realpath
|
from os.path import join, realpath
|
||||||
|
|
||||||
from pygit2 import GIT_OBJ_ANY, GIT_OBJ_BLOB, GIT_OBJ_COMMIT, init_repository, \
|
from pygit2 import GIT_OBJ_ANY, GIT_OBJ_BLOB, GIT_OBJ_COMMIT, init_repository, \
|
||||||
discover_repository
|
discover_repository, Commit
|
||||||
from . import utils
|
from . import utils
|
||||||
|
|
||||||
|
|
||||||
__author__ = 'dborowitz@google.com (Dave Borowitz)'
|
__author__ = 'dborowitz@google.com (Dave Borowitz)'
|
||||||
|
|
||||||
|
HEAD_SHA = '5fe808e8953c12735680c257f56600cb0de44b10'
|
||||||
A_HEX_SHA = 'af431f20fc541ed6d5afede3e2dc7160f6f01f16'
|
A_HEX_SHA = 'af431f20fc541ed6d5afede3e2dc7160f6f01f16'
|
||||||
A_BIN_SHA = binascii.unhexlify(A_HEX_SHA.encode('ascii'))
|
A_BIN_SHA = binascii.unhexlify(A_HEX_SHA.encode('ascii'))
|
||||||
|
|
||||||
|
|
||||||
class RepositoryTest(utils.BareRepoTestCase):
|
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):
|
def test_read(self):
|
||||||
self.assertRaises(TypeError, self.repo.read, 123)
|
self.assertRaises(TypeError, self.repo.read, 123)
|
||||||
self.assertRaisesWithArg(KeyError, '1' * 40, self.repo.read, '1' * 40)
|
self.assertRaisesWithArg(KeyError, '1' * 40, self.repo.read, '1' * 40)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user