Gerrit git cl upload: implement patchset title (message).
[email protected],[email protected]
BUG=579178
Review URL: https://codereview.chromium.org/1886433003
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299886 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
index eca9cf4..cbeec08 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -738,6 +738,7 @@
@classmethod
def _gerrit_upload_calls(cls, description, reviewers, squash,
expected_upstream_ref='origin/refs/heads/master',
+ ref_suffix='',
post_amend_description=None, issue=None):
if post_amend_description is None:
post_amend_description = description
@@ -810,7 +811,7 @@
calls += [
((['git',
'push', receive_pack, 'origin',
- ref_to_push + ':refs/for/refs/heads/master'],),
+ ref_to_push + ':refs/for/refs/heads/master' + ref_suffix],),
('remote:\n'
'remote: Processing changes: (\)\n'
'remote: Processing changes: (|)\n'
@@ -840,18 +841,21 @@
self,
upload_args,
description,
- reviewers,
+ reviewers=None,
squash=False,
expected_upstream_ref='origin/refs/heads/master',
+ ref_suffix='',
post_amend_description=None,
issue=None):
"""Generic gerrit upload test framework."""
+ reviewers = reviewers or []
self.mock(git_cl.gerrit_util, "CookiesAuthenticator",
CookiesAuthenticatorMockFactory(same_cookie='same_cred'))
self.calls = self._gerrit_base_calls(issue=issue)
self.calls += self._gerrit_upload_calls(
description, reviewers, squash,
expected_upstream_ref=expected_upstream_ref,
+ ref_suffix=ref_suffix,
post_amend_description=post_amend_description,
issue=issue)
# Uncomment when debugging.
@@ -872,6 +876,12 @@
'desc\n\nBUG=\n\nChange-Id: I123456789\n',
[])
+ def test_gerrit_patch_title(self):
+ self._run_gerrit_upload_test(
+ ['-t', 'Don\'t put under_scores as they become spaces'],
+ 'desc\n\nBUG=\n\nChange-Id: I123456789',
+ ref_suffix='%m=Don\'t_put_under_scores_as_they_become_spaces')
+
def test_gerrit_reviewers_cmd_line(self):
self._run_gerrit_upload_test(
['-r', '[email protected]'],