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']) |