Index: tests/git_cl_test.py |
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py |
index 66d05959ee046ad9cdc7fe8672dbab1b6c973c2f..0e37ac482dbe5848cfeb17939d0b7507ffb0282a 100755 |
--- a/tests/git_cl_test.py |
+++ b/tests/git_cl_test.py |
@@ -1022,6 +1022,18 @@ class TestGitCl(TestCase): |
change_id = git_cl.GenerateGerritChangeId('line1\nline2\n') |
self.assertEqual(change_id, 'Ihashchange') |
+ def test_desecription_append_footer(self): |
+ for init_desc, footer_line, expected_desc in [ |
+ # Use unique desc first lines for easy test failure identification. |
+ ('foo', 'R=one', 'foo\n\nR=one'), |
+ ('foo\n\nR=one', 'BUG=', 'foo\n\nR=one\nBUG='), |
+ ('foo\n\nR=one', 'Change-Id: Ixx', 'foo\n\nR=one\n\nChange-Id: Ixx'), |
+ ('foo\n\nChange-Id: Ixx', 'R=one', 'foo\n\nR=one\n\nChange-Id: Ixx'), |
Sergiy Byelozyorov
2016/06/02 22:59:53
Also test adding a new footer to an existing one (
tandrii(chromium)
2016/06/03 09:34:59
Done.
|
+ ]: |
+ desc = git_cl.ChangeDescription(init_desc) |
+ desc.append_footer(footer_line) |
+ self.assertEqual(desc.description, expected_desc) |
+ |
def test_update_reviewers(self): |
data = [ |
('foo', [], 'foo'), |
@@ -1444,7 +1456,7 @@ class TestGitCl(TestCase): |
self.assertEqual('hihi', ChangelistMock.desc) |
def test_description_appends_bug_line(self): |
- current_desc = 'Some\n\nChange-Id: xxx' |
+ current_desc = 'Some.\n\nChange-Id: xxx' |
def RunEditor(desc, _, **kwargs): |
self.assertEquals( |
@@ -1452,15 +1464,14 @@ class TestGitCl(TestCase): |
'# This will be displayed on the codereview site.\n' |
'# The first line will also be used as the subject of the review.\n' |
'#--------------------This line is 72 characters long' |
- '--------------------\n' + |
- # TODO(tandrii): fix this http://crbug.com/614587. |
- current_desc + '\n\nBUG=', |
+ '--------------------\n' |
+ 'Some.\n\nBUG=\n\nChange-Id: xxx', |
desc) |
- return current_desc + '\n\nBUG=' |
+ # Simulate user changing something. |
+ return 'Some.\n\nBUG=123\n\nChange-Id: xxx' |
def UpdateDescriptionRemote(_, desc): |
- # TODO(tandrii): fix this http://crbug.com/614587. |
- self.assertEquals(desc, current_desc + '\n\nBUG=') |
+ self.assertEquals(desc, 'Some.\n\nBUG=123\n\nChange-Id: xxx') |
self.mock(git_cl.sys, 'stdout', StringIO.StringIO()) |
self.mock(git_cl.Changelist, 'GetDescription', |