diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_reflog.py | 18 | ||||
-rw-r--r-- | test/test_refs.py | 1 | ||||
-rw-r--r-- | test/test_util.py | 8 |
3 files changed, 24 insertions, 3 deletions
diff --git a/test/test_reflog.py b/test/test_reflog.py index a017106e..67b1a9da 100644 --- a/test/test_reflog.py +++ b/test/test_reflog.py @@ -1,6 +1,7 @@ from git.test.lib import * -from git.objects import IndexObject, Actor +from git.objects import IndexObject from git.refs import * +from git.util import Actor import tempfile import shutil @@ -40,6 +41,7 @@ class TestRefLog(TestBase): # simple read reflog = RefLog.from_file(rlp_master_ro) + assert reflog._path is not None assert isinstance(reflog, RefLog) assert len(reflog) @@ -56,6 +58,8 @@ class TestRefLog(TestBase): # test serialize and deserialize - results must match exactly + binsha = chr(255)*20 + msg = "my reflog message" for rlp in (rlp_head, rlp_master): reflog = RefLog.from_file(rlp) tfile = os.path.join(tdir, os.path.basename(rlp)) @@ -67,6 +71,18 @@ class TestRefLog(TestBase): # ... as well as each bytes of the written stream assert open(tfile).read() == open(rlp).read() + + # append an entry - it gets written automatically + entry = treflog.append_entry(IndexObject.NULL_BIN_SHA, binsha, msg) + assert entry.oldhexsha == IndexObject.NULL_HEX_SHA + assert entry.newhexsha == 'f'*40 + assert entry.message == msg + assert treflog == RefLog.from_file(tfile) + + # but not this time + treflog.append_entry(binsha, binsha, msg, write=False) + assert treflog != RefLog.from_file(tfile) + # END for each reflog diff --git a/test/test_refs.py b/test/test_refs.py index 1f3dfb9f..c7764d92 100644 --- a/test/test_refs.py +++ b/test/test_refs.py @@ -8,6 +8,7 @@ from mock import * from git.test.lib import * from git import * import git.refs as refs +from git.util import Actor from git.objects.tag import TagObject from itertools import chain import os diff --git a/test/test_util.py b/test/test_util.py index 7a6eb27d..e55a6d15 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -16,7 +16,7 @@ from git.cmd import dashify import time -class TestUtils(TestCase): +class TestUtils(TestBase): def setup(self): self.testdict = { "string": "42", @@ -102,4 +102,8 @@ class TestUtils(TestCase): self.failUnlessRaises(ValueError, parse_date, '123456789 -02000') self.failUnlessRaises(ValueError, parse_date, ' 123456789 -0200') - + def test_actor(self): + for cr in (None, self.rorepo.config_reader()): + assert isinstance(Actor.committer(cr), Actor) + assert isinstance(Actor.author(cr), Actor) + #END assure config reader is handled |