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

Unified Diff: tests/git_cl_test.py

Issue 2033783002: git cl desc: add test that shows BUG= breaking Change-Id footer. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@review-url
Patch Set: rebases Created 4 years, 7 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 | « no previous file | 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 064520ca969d22282decd5a57e4554ec32941a18..0084001888f2c78f3ee00f501d0ef0f44bcb1fb8 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -1443,6 +1443,41 @@ class TestGitCl(TestCase):
self.assertEqual(0, git_cl.main(['description', '-n', 'hihi']))
self.assertEqual('hihi', ChangelistMock.desc)
+ def test_description_appends_bug_line(self):
+ current_desc = 'Some\n\nChange-Id: xxx'
+
+ def RunEditor(desc, _, **kwargs):
+ self.assertEquals(
+ '# Enter a description of the change.\n'
+ '# 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=',
+ desc)
+ return current_desc + '\n\nBUG='
+
+ def UpdateDescriptionRemote(_, desc):
+ # TODO(tandrii): fix this http://crbug.com/614587.
+ self.assertEquals(desc, current_desc + '\n\nBUG=')
+
+ self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
+ self.mock(git_cl.Changelist, 'GetDescription',
+ lambda *args: current_desc)
+ self.mock(git_cl._GerritChangelistImpl, 'UpdateDescriptionRemote',
+ UpdateDescriptionRemote)
+ self.mock(git_cl.gclient_utils, 'RunEditor', RunEditor)
+
+ self.calls = [
+ ((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
+ ((['git', 'config', 'branch.feature.gerritissue'],), '123'),
+ ((['git', 'config', 'rietveld.autoupdate'],), ''),
+ ((['git', 'config', 'rietveld.bug-prefix'],), ''),
+ ((['git', 'config', 'core.editor'],), 'vi'),
+ ]
+ self.assertEqual(0, git_cl.main(['description', '--gerrit']))
+
def test_description_set_stdin(self):
out = StringIO.StringIO()
self.mock(git_cl.sys, 'stdout', out)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698