summaryrefslogtreecommitdiff
path: root/test/git
diff options
context:
space:
mode:
Diffstat (limited to 'test/git')
-rw-r--r--test/git/test_base.py10
-rw-r--r--test/git/test_blob.py49
-rw-r--r--test/git/test_commit.py2
-rw-r--r--test/git/test_repo.py10
4 files changed, 17 insertions, 54 deletions
diff --git a/test/git/test_base.py b/test/git/test_base.py
index 97dfc255..6e3aad7f 100644
--- a/test/git/test_base.py
+++ b/test/git/test_base.py
@@ -73,6 +73,16 @@ class TestBase(object):
assert len(s) == ref_count
assert len(s|s) == ref_count
+ def test_heads(self):
+ # see how it dynmically updates its object
+ for head in self.repo.heads:
+ head.name
+ head.path
+ cur_obj = head.object
+ del( head.object )
+ assert cur_obj == head.object
+ # END for each head
+
def test_get_object_type_by_name(self):
for tname in base.Object.TYPES:
assert base.Object in get_object_type_by_name(tname).mro()
diff --git a/test/git/test_blob.py b/test/git/test_blob.py
index ebb53d0c..266f3a23 100644
--- a/test/git/test_blob.py
+++ b/test/git/test_blob.py
@@ -12,51 +12,14 @@ class TestBlob(object):
def setup(self):
self.repo = Repo(GIT_REPO)
- @patch_object(Git, '_call_process')
- def test_should_return_blob_contents(self, git):
- git.return_value = fixture('cat_file_blob')
- blob = Blob(self.repo, **{'id': '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(Git, '_call_process')
- def test_should_return_blob_contents_with_newline(self, git):
- git.return_value = fixture('cat_file_blob_nl')
- blob = Blob(self.repo, **{'id': 'abc'})
- assert_equal("Hello world\n", blob.data)
- assert_true(git.called)
- assert_equal(git.call_args, (('cat_file', 'abc'), {'p': True, 'with_raw_output': True}))
-
- @patch_object(Git, '_call_process')
- def test_should_cache_data(self, git):
- git.return_value = fixture('cat_file_blob')
- bid = '787b92b63f629398f3d2ceb20f7f0c2578259e84'
+ def test_should_cache_data(self):
+ bid = 'a802c139d4767c89dcad79d836d05f7004d39aac'
blob = Blob(self.repo, bid)
blob.data
- blob.data
- assert_true(git.called)
- assert_equal(git.call_count, 1)
- assert_equal(git.call_args, (('cat_file', bid), {'p': True, 'with_raw_output': True}))
-
- @patch_object(Git, '_call_process')
- def test_should_return_file_size(self, git):
- git.return_value = fixture('cat_file_blob_size')
- blob = Blob(self.repo, **{'id': 'abc'})
- assert_equal(11, blob.size)
- assert_true(git.called)
- assert_equal(git.call_args, (('cat_file', 'abc'), {'s': True}))
-
- @patch_object(Git, '_call_process')
- def test_should_cache_file_size(self, git):
- git.return_value = fixture('cat_file_blob_size')
- blob = Blob(self.repo, **{'id': 'abc'})
- assert_equal(11, blob.size)
- assert_equal(11, blob.size)
- assert_true(git.called)
- assert_equal(git.call_count, 1)
- assert_equal(git.call_args, (('cat_file', 'abc'), {'s': True}))
-
+ assert blob.data
+ blob.size
+ blob.size
+
def test_mime_type_should_return_mime_type_for_known_types(self):
blob = Blob(self.repo, **{'id': 'abc', 'path': 'foo.png'})
assert_equal("image/png", blob.mime_type)
diff --git a/test/git/test_commit.py b/test/git/test_commit.py
index fd8fc51e..c050fd11 100644
--- a/test/git/test_commit.py
+++ b/test/git/test_commit.py
@@ -204,7 +204,7 @@ class TestCommit(object):
bisect_all=True)
assert_true(git.called)
- commits = Commit._iter_from_process(self.repo, ListProcessAdapter(revs))
+ commits = Commit._iter_from_process_or_stream(self.repo, ListProcessAdapter(revs))
expected_ids = (
'cf37099ea8d1d8c7fbf9b6d12d7ec0249d3acb8b',
'33ebe7acec14b25c5f84f35a664803fcab2f7781',
diff --git a/test/git/test_repo.py b/test/git/test_repo.py
index f0687050..b882752d 100644
--- a/test/git/test_repo.py
+++ b/test/git/test_repo.py
@@ -96,16 +96,6 @@ class TestRepo(object):
assert_true(git.called)
- @patch_object(Git, '_call_process')
- def test_blob(self, git):
- git.return_value = fixture('cat_file_blob')
-
- blob = Blob(self.repo,"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):