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

Unified Diff: tests/git_cl_test.py

Issue 11236013: Add gerrit Change-Id to commit messages if they do not have one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Addressing cmp's and maruel's comments. Created 8 years, 2 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
« git_cl.py ('K') | « 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 3ca0f2b330a50b15a86d67c7cdd836114982944d..94243d5f8fadbc63da482c56a60b8ad8da051d41 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -393,7 +393,18 @@ class TestGitCl(TestCase):
def _gerrit_upload_calls(description, reviewers):
calls = [
((['git', 'log', '--pretty=format:%s\n\n%b', 'master..'],),
- description),
+ description)
+ ]
+ if git_cl.CHANGE_ID_STR not in description:
cmp 2012/10/20 22:42:31 CHANGE_ID_STR -> CHANGE_ID here, too
Siva Chandra 2012/10/22 07:13:56 Done.
+ calls += [
+ ((['git', 'log', '--pretty=format:%s\n\n%b', 'master..'],),
+ description),
+ ((['git', 'commit', '--amend', '-m', description],),
+ ''),
+ ((['git', 'log', '--pretty=format:%s\n\n%b', 'master..'],),
+ description)
+ ]
+ calls += [
((['git', 'config', 'rietveld.cc'],), '')
]
receive_pack = '--receive-pack=git receive-pack '
@@ -408,32 +419,39 @@ class TestGitCl(TestCase):
]
return calls
- def _run_gerrit_reviewer_test(
+ def _run_gerrit_upload_test(
self,
upload_args,
description,
reviewers):
- """Generic gerrit reviewer test framework."""
+ """Generic gerrit upload test framework."""
self.calls = self._gerrit_base_calls()
self.calls += self._gerrit_upload_calls(description, reviewers)
git_cl.main(['upload'] + upload_args)
- def test_gerrit_no_reviewer(self):
- self._run_gerrit_reviewer_test(
+ def test_gerrit_upload_without_change_id(self):
+ self._run_gerrit_upload_test(
[],
'desc\n\nBUG=\n',
[])
+ def test_gerrit_no_reviewer(self):
+ self._run_gerrit_upload_test(
+ [],
+ 'desc\n\nBUG=\nChange-Id:123456789\n',
+ [])
+
def test_gerrit_reviewers_cmd_line(self):
- self._run_gerrit_reviewer_test(
+ self._run_gerrit_upload_test(
['-r', 'foo@example.com'],
- 'desc\n\nBUG=\n',
+ 'desc\n\nBUG=\nChange-Id:123456789',
['foo@example.com'])
def test_gerrit_reviewer_multiple(self):
- self._run_gerrit_reviewer_test(
+ self._run_gerrit_upload_test(
[],
- 'desc\nTBR=reviewer@example.com\nBUG=\nR=another@example.com\n',
+ 'desc\nTBR=reviewer@example.com\nBUG=\nR=another@example.com\n'
+ 'Change-Id:123456789\n',
['reviewer@example.com', 'another@example.com'])
« git_cl.py ('K') | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698