added tests for remote.fetch()
This commit is contained in:
parent
3bf32f707a
commit
9c9e0f9755
@ -193,7 +193,7 @@ Remote_fetch(Remote *self, PyObject *args)
|
|||||||
err = git_remote_download(self->remote, NULL, NULL);
|
err = git_remote_download(self->remote, NULL, NULL);
|
||||||
if (err == GIT_OK) {
|
if (err == GIT_OK) {
|
||||||
stats = git_remote_stats(self->remote);
|
stats = git_remote_stats(self->remote);
|
||||||
py_stats = Py_BuildValue("{s:i,s:i,s:i}",
|
py_stats = Py_BuildValue("{s:I,s:I,s:n}",
|
||||||
"indexed_objects", stats->indexed_objects,
|
"indexed_objects", stats->indexed_objects,
|
||||||
"received_objects", stats->received_objects,
|
"received_objects", stats->received_objects,
|
||||||
"received_bytes", stats->received_bytes);
|
"received_bytes", stats->received_bytes);
|
||||||
|
@ -35,6 +35,8 @@ REMOTE_NAME = 'origin'
|
|||||||
REMOTE_URL = 'git://github.com/libgit2/pygit2.git'
|
REMOTE_URL = 'git://github.com/libgit2/pygit2.git'
|
||||||
REMOTE_FETCHSPEC_SRC = 'refs/heads/*'
|
REMOTE_FETCHSPEC_SRC = 'refs/heads/*'
|
||||||
REMOTE_FETCHSPEC_DST = 'refs/remotes/origin/*'
|
REMOTE_FETCHSPEC_DST = 'refs/remotes/origin/*'
|
||||||
|
REMOTE_REPO_OBJECTS = 19
|
||||||
|
REMOTE_REPO_BYTES = 1586
|
||||||
|
|
||||||
class RepositoryTest(utils.RepoTestCase):
|
class RepositoryTest(utils.RepoTestCase):
|
||||||
def test_remote_create(self):
|
def test_remote_create(self):
|
||||||
@ -93,3 +95,12 @@ class RepositoryTest(utils.RepoTestCase):
|
|||||||
url = 'git://github.com/libgit2/pygit2.git'
|
url = 'git://github.com/libgit2/pygit2.git'
|
||||||
remote = self.repo.remote_create(name, url);
|
remote = self.repo.remote_create(name, url);
|
||||||
self.assertTrue(remote.name in [x.name for x in self.repo.remotes])
|
self.assertTrue(remote.name in [x.name for x in self.repo.remotes])
|
||||||
|
|
||||||
|
|
||||||
|
class EmptyRepositoryTest(utils.EmptyRepoTestCase):
|
||||||
|
def test_fetch(self):
|
||||||
|
remote = self.repo.remotes[0]
|
||||||
|
stats = remote.fetch()
|
||||||
|
self.assertEqual(stats['received_bytes'], REMOTE_REPO_BYTES)
|
||||||
|
self.assertEqual(stats['indexed_objects'], REMOTE_REPO_OBJECTS)
|
||||||
|
self.assertEqual(stats['received_objects'], REMOTE_REPO_OBJECTS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user