Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(850)

Unified Diff: tests/git_cl_test.py

Issue 2038673002: git cl description: avoid appending BUG= after Change-Id. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@bug-footer-fix
Patch Set: nit Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/git_cl_test.py
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index 0084001888f2c78f3ee00f501d0ef0f44bcb1fb8..42ffba4f5eaf4ca8711384386a601637f298114f 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -1022,6 +1022,25 @@ 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'),
+ ('foo\n\nR=one\n\nChange-Id: Ixx', 'TBR=two',
+ 'foo\n\nR=one\nTBR=two\n\nChange-Id: Ixx'),
+ ('foo\n\nR=one\n\nChange-Id: Ixx', 'Foo-Bar: baz',
+ 'foo\n\nR=one\n\nChange-Id: Ixx\nFoo-Bar: baz'),
+ ('foo\n\nChange-Id: Ixx', 'Foo-Bak: baz',
+ 'foo\n\nChange-Id: Ixx\nFoo-Bak: baz'),
+ ('foo', 'Change-Id: Ixx', 'foo\n\nChange-Id: Ixx'),
+ ]:
+ 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 +1463,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 +1471,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',
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698