| Index: tests/git_cl_test.py
|
| diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py
|
| index b0048a11d9cee39d22648e9d50a92e752cdc4e6f..1d21344e42e7fdb8114015ae036a413ccee75f29 100755
|
| --- a/tests/git_cl_test.py
|
| +++ b/tests/git_cl_test.py
|
| @@ -757,15 +757,32 @@ class TestGitCl(TestCase):
|
|
|
| @classmethod
|
| def _gerrit_upload_calls(cls, description, reviewers, squash,
|
| + squash_mode='default',
|
| expected_upstream_ref='origin/refs/heads/master',
|
| ref_suffix='', notify=False,
|
| post_amend_description=None, issue=None):
|
| if post_amend_description is None:
|
| post_amend_description = description
|
| + calls = []
|
| +
|
| + # TODO(tandrii): remove duplication here once warning message is removed.
|
| + # see http://crbug.com/611892
|
| + if squash_mode == 'default':
|
| + calls.extend([
|
| + ((['git', 'config', '--bool', 'gerrit.override-squash-uploads'],), ''),
|
| + ((['git', 'config', '--bool', 'gerrit.squash-uploads'],), ''),
|
| + ((['git', 'config', '--bool', 'gerrit.override-squash-uploads'],), ''),
|
| + ])
|
| + elif squash_mode in ('override_squash', 'override_nosquash'):
|
| + calls.extend([
|
| + ((['git', 'config', '--bool', 'gerrit.override-squash-uploads'],),
|
| + 'true' if squash_mode == 'override_squash' else 'false'),
|
| + ((['git', 'config', '--bool', 'gerrit.override-squash-uploads'],),
|
| + 'true' if squash_mode == 'override_squash' else 'false'),
|
| + ])
|
| + else:
|
| + assert squash_mode in ('squash', 'nosquash')
|
|
|
| - calls = [
|
| - ((['git', 'config', '--bool', 'gerrit.squash-uploads'],), 'false'),
|
| - ]
|
| # If issue is given, then description is fetched from Gerrit instead.
|
| if issue is None:
|
| if squash:
|
| @@ -868,12 +885,21 @@ class TestGitCl(TestCase):
|
| description,
|
| reviewers=None,
|
| squash=False,
|
| + squash_mode=None,
|
| expected_upstream_ref='origin/refs/heads/master',
|
| ref_suffix='',
|
| notify=False,
|
| post_amend_description=None,
|
| issue=None):
|
| """Generic gerrit upload test framework."""
|
| + if squash_mode is None:
|
| + if '--no-squash' in upload_args:
|
| + squash_mode = 'nosquash'
|
| + elif '--squash' in upload_args:
|
| + squash_mode = 'squash'
|
| + else:
|
| + squash_mode = 'default'
|
| +
|
| reviewers = reviewers or []
|
| self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
|
| self.mock(git_cl.gerrit_util, 'CookiesAuthenticator',
|
| @@ -883,6 +909,7 @@ class TestGitCl(TestCase):
|
| self.calls = self._gerrit_base_calls(issue=issue)
|
| self.calls += self._gerrit_upload_calls(
|
| description, reviewers, squash,
|
| + squash_mode=squash_mode,
|
| expected_upstream_ref=expected_upstream_ref,
|
| ref_suffix=ref_suffix, notify=notify,
|
| post_amend_description=post_amend_description,
|
| @@ -899,6 +926,15 @@ class TestGitCl(TestCase):
|
| [],
|
| post_amend_description='desc\n\nBUG=\n\nChange-Id: Ixxx')
|
|
|
| + def test_gerrit_upload_without_change_id_override_nosquash(self):
|
| + self.mock(git_cl, 'DownloadGerritHook', self._mocked_call)
|
| + self._run_gerrit_upload_test(
|
| + [],
|
| + 'desc\n\nBUG=\n',
|
| + [],
|
| + squash_mode='override_nosquash',
|
| + post_amend_description='desc\n\nBUG=\n\nChange-Id: Ixxx')
|
| +
|
| def test_gerrit_no_reviewer(self):
|
| self._run_gerrit_upload_test(
|
| [],
|
|
|