diff options
author | masklinn <bitbucket.org@masklinn.net> | 2014-03-11 10:50:08 +0100 |
---|---|---|
committer | masklinn <bitbucket.org@masklinn.net> | 2014-03-11 10:50:08 +0100 |
commit | a1bc3a35231f657c289b32bd687d14214d6d09a5 (patch) | |
tree | 8170e52e8f3d0242b5ac785a7c9f12f67880e10d | |
parent | f258de49c1a6080c1f1209e28ce9d08c77749982 (diff) | |
download | python-fastimport-git-a1bc3a35231f657c289b32bd687d14214d6d09a5.tar.gz |
Add tests for notemodify
-rw-r--r-- | fastimport/tests/test_commands.py | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/fastimport/tests/test_commands.py b/fastimport/tests/test_commands.py index 1259798..2d4d5d5 100644 --- a/fastimport/tests/test_commands.py +++ b/fastimport/tests/test_commands.py @@ -314,6 +314,81 @@ class TestFileDeleteAllDisplay(TestCase): c = commands.FileDeleteAllCommand() self.assertEqual("deleteall", repr(c)) +class TestNotesDisplay(TestCase): + + def test_noteonly(self): + c = commands.NoteModifyCommand('foo', "A basic note") + self.assertEqual('N inline :foo\ndata 12\nA basic note', repr(c)) + + def test_notecommit(self): + committer = ("Ed Mund", 'ed@example.org', 1234565432, 0) + + commits = [ + commands.CommitCommand( + ref='refs/heads/master', + mark='1', + author=committer, + committer=committer, + message="test\n", + from_=None, + merges=[], + file_iter=[ + commands.FileModifyCommand('bar', 0100644, None, '') + ]), + commands.CommitCommand( + ref='refs/notes/commits', + mark=None, + author=None, + committer=committer, + message="Notes added by 'git notes add'\n", + from_=None, + merges=[], + file_iter=[ + commands.NoteModifyCommand('1', "Test note\n") + ]), + commands.CommitCommand( + ref='refs/notes/test', + mark=None, + author=None, + committer=committer, + message="Notes added by 'git notes add'\n", + from_=None, + merges=[], + file_iter=[ + commands.NoteModifyCommand('1', "Test test\n") + ]) + ] + + self.assertEqual( + """commit refs/heads/master +mark :1 +author %(user)s +committer %(user)s +data 5 +test + +M 644 inline bar +data 0 +commit refs/notes/commits +committer %(user)s +data 31 +Notes added by 'git notes add' + +N inline :1 +data 10 +Test note +commit refs/notes/test +committer %(user)s +data 31 +Notes added by 'git notes add' + +N inline :1 +data 10 +Test test +""" % { + 'user': '%s <%s> %d %+05d' % committer, +}, ''.join(map(repr, commits))) + class TestPathChecking(TestCase): |