summaryrefslogtreecommitdiff
path: root/test/git/test_repo.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/git/test_repo.py')
-rw-r--r--test/git/test_repo.py48
1 files changed, 4 insertions, 44 deletions
diff --git a/test/git/test_repo.py b/test/git/test_repo.py
index 3e2fb3dc..e998ac6d 100644
--- a/test/git/test_repo.py
+++ b/test/git/test_repo.py
@@ -41,7 +41,7 @@ class TestRepo(object):
@patch_object(Git, '_call_process')
def test_commits(self, git):
- git.return_value = fixture('rev_list')
+ git.return_value = ListProcessAdapter(fixture('rev_list'))
commits = self.repo.commits('master', max_count=10)
@@ -65,7 +65,6 @@ class TestRepo(object):
assert_equal("Merge branch 'site'", c.summary)
assert_true(git.called)
- assert_equal(git.call_args, (('rev_list', 'master', '--', ''), {'skip': 0, 'pretty': 'raw', 'max_count': 10}))
@patch_object(Git, '_call_process')
def test_commit_count(self, git):
@@ -78,37 +77,14 @@ class TestRepo(object):
@patch_object(Git, '_call_process')
def test_commit(self, git):
- git.return_value = fixture('rev_list_single')
+ git.return_value = ListProcessAdapter(fixture('rev_list_single'))
commit = self.repo.commit('4c8124ffcf4039d292442eeccabdeca5af5c5017')
assert_equal("4c8124ffcf4039d292442eeccabdeca5af5c5017", commit.id)
assert_true(git.called)
- assert_equal(git.call_args, (('rev_list', '4c8124ffcf4039d292442eeccabdeca5af5c5017', '--', ''), {'pretty': 'raw', 'max_count': 1}))
-
- @patch_object(Git, '_call_process')
- def test_tree(self, git):
- git.return_value = fixture('ls_tree_a')
-
- tree = self.repo.tree('master')
-
- assert_equal(4, len([c for c in tree.values() if isinstance(c, Blob)]))
- assert_equal(3, len([c for c in tree.values() if isinstance(c, Tree)]))
-
- assert_true(git.called)
- assert_equal(git.call_args, (('ls_tree', 'master'), {}))
-
- @patch_object(Git, '_call_process')
- def test_blob(self, git):
- git.return_value = fixture('cat_file_blob')
-
- blob = self.repo.blob("abc")
- assert_equal("Hello world", blob.data)
-
- assert_true(git.called)
- assert_equal(git.call_args, (('cat_file', 'abc'), {'p': True, 'with_raw_output': True}))
-
+
@patch_object(Repo, '__init__')
@patch_object(Git, '_call_process')
def test_init_bare(self, git, repo):
@@ -218,22 +194,6 @@ class TestRepo(object):
path = os.path.join(os.path.abspath(GIT_REPO), '.git')
assert_equal('<git.Repo "%s">' % path, repr(self.repo))
- @patch_object(Git, '_call_process')
- def test_log(self, git):
- git.return_value = fixture('rev_list')
- assert_equal('4c8124ffcf4039d292442eeccabdeca5af5c5017', self.repo.log()[0].id)
- assert_equal('ab25fd8483882c3bda8a458ad2965d2248654335', self.repo.log()[-1].id)
- assert_true(git.called)
- assert_equal(git.call_count, 2)
- assert_equal(git.call_args, (('log', 'master', '--'), {'pretty': 'raw'}))
-
- @patch_object(Git, '_call_process')
- def test_log_with_path_and_options(self, git):
- git.return_value = fixture('rev_list')
- self.repo.log('master', 'file.rb', **{'max_count': 1})
- assert_true(git.called)
- assert_equal(git.call_args, (('log', 'master', '--', 'file.rb'), {'pretty': 'raw', 'max_count': 1}))
-
def test_is_dirty_with_bare_repository(self):
self.repo.bare = True
assert_false(self.repo.is_dirty)
@@ -255,7 +215,7 @@ class TestRepo(object):
@patch_object(Git, '_call_process')
def test_active_branch(self, git):
git.return_value = 'refs/heads/major-refactoring'
- assert_equal(self.repo.active_branch, 'major-refactoring')
+ assert_equal(self.repo.active_branch.name, 'major-refactoring')
assert_equal(git.call_args, (('symbolic_ref', 'HEAD'), {}))
@patch_object(Git, '_call_process')