From 6e5aae2fc8c3832bdae1cd5e0a269405fb059231 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 23 Nov 2010 12:35:34 +0100 Subject: Initial interface including some of the implementation of the RefLog. TestCase scetched out for now tests: Added tests to verify that objects don't have a dict. Previously, due to a missing __slots__ member in Serializable, most objects would indeed have a dict, although the opposite was intended --- test/test_reflog.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/test_reflog.py (limited to 'test/test_reflog.py') diff --git a/test/test_reflog.py b/test/test_reflog.py new file mode 100644 index 00000000..efcc7f33 --- /dev/null +++ b/test/test_reflog.py @@ -0,0 +1,32 @@ +from git.test.lib import * +from git.objects import IndexObject, Actor +from git.refs import * + +class TestRefLog(TestBase): + + def test_reflogentry(self): + nullhexsha = IndexObject.NULL_HEX_SHA + hexsha = 'F' * 40 + actor = Actor('name', 'email') + msg = "message" + + self.failUnlessRaises(ValueError, RefLogEntry.new, nullhexsha, hexsha, 'noactor', 0, 0, "") + e = RefLogEntry.new(nullhexsha, hexsha, actor, 0, 1, msg) + + assert e.oldhexsha == nullhexsha + assert e.newhexsha == hexsha + assert e.actor == actor + assert e.time[0] == 0 + assert e.time[1] == 1 + assert e.message == msg + + # check representation (roughly) + assert repr(e).startswith(nullhexsha) + + def test_base(self): + pass + # raise on invalid revlog + # TODO: Try multiple corrupted ones ! + + + # test serialize and deserialize - results must match exactly -- cgit v1.2.3