diff options
author | Sebastian Thiel <byronimo@gmail.com> | 2010-06-02 23:53:29 +0200 |
---|---|---|
committer | Sebastian Thiel <byronimo@gmail.com> | 2010-06-02 23:53:29 +0200 |
commit | 6f8ce8901e21587cd2320562df412e05b5ab1731 (patch) | |
tree | 4376f34c327896f7951bc1af7c7d93896decf863 /test/git/test_odb.py | |
parent | 8b86f9b399a8f5af792a04025fdeefc02883f3e5 (diff) | |
download | gitpython-6f8ce8901e21587cd2320562df412e05b5ab1731.tar.gz |
added frame for object reading, including simple test
Diffstat (limited to 'test/git/test_odb.py')
-rw-r--r-- | test/git/test_odb.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/git/test_odb.py b/test/git/test_odb.py index bc92a493..b2840719 100644 --- a/test/git/test_odb.py +++ b/test/git/test_odb.py @@ -3,6 +3,7 @@ from test.testlib import * from git.odb.db import * from git import Blob +from git.errors import BadObject from cStringIO import StringIO import os @@ -26,6 +27,18 @@ class TestDB(TestBase): sha = db.to_object(Blob.type, len(data), StringIO(data), dry_run, hex_sha) assert db.has_object(sha) != dry_run assert len(sha) == 20 + hex_sha * 20 + + # verify data - the slow way, we want to run code + if not dry_run: + type, size = db.object_info(sha) + assert Blob.type == type + assert size == len(data) + + type, size, stream = db.object(sha) + assert stream.read() == data + else: + self.failUnlessRaises(BadObject, db.object_info, sha) + self.failUnlessRaises(BadObject, db.object, sha) # END for each sha type # END for each data set # END for each dry_run mode |