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

Unified Diff: tests/git_cl_test.py

Issue 2147563003: git cl try: Trigger CQ Dry Run by default. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Explain what happened on success. Created 4 years, 5 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 c500b815323a9ceb0dec3205af4faf258237564d..4babe2a05ae62d2789981c3771c5ad108c67a1c6 100755
--- a/tests/git_cl_test.py
+++ b/tests/git_cl_test.py
@@ -1660,6 +1660,44 @@ class TestGitCl(TestCase):
]
self.assertEqual(0, git_cl.main(['issue', '0']))
+ def test_git_cl_try_default(self):
+ self.mock(git_cl.Changelist, 'GetChange',
+ lambda _, *a: (
+ self._mocked_call(['GetChange']+list(a))))
+ self.mock(git_cl.presubmit_support, 'DoGetTryMasters',
+ lambda *_, **__: (
+ self._mocked_call(['DoGetTryMasters'])))
+ self.mock(git_cl.presubmit_support, 'DoGetTrySlaves',
+ lambda *_, **__: (
+ self._mocked_call(['DoGetTrySlaves'])))
+ self.mock(git_cl._RietveldChangelistImpl, 'SetCQState',
+ lambda _, s: self._mocked_call(['SetCQState', s]))
+ self.calls = [
+ ((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
+ ((['git', 'config', 'branch.feature.rietveldissue'],), '123'),
+ ((['git', 'config', 'rietveld.autoupdate'],), ''),
+ ((['git', 'config', 'rietveld.server'],),
+ 'https://codereview.chromium.org'),
+ ((['git', 'config', 'branch.feature.rietveldserver'],), ''),
+ ((['git', 'config', 'branch.feature.merge'],), 'feature'),
+ ((['git', 'config', 'branch.feature.remote'],), 'origin'),
+ ((['get_or_create_merge_base', 'feature', 'feature'],),
+ 'fake_ancestor_sha'),
+ ((['GetChange', 'fake_ancestor_sha', None], ),
+ git_cl.presubmit_support.GitChange(
+ '', '', '', '', '', '', '', '')),
+ ((['git', 'rev-parse', '--show-cdup'],), '../'),
+ ((['DoGetTryMasters'], ), None),
+ ((['DoGetTrySlaves'], ), None),
+ ((['SetCQState', git_cl._CQState.DRY_RUN], ), None),
+ ]
+ out = StringIO.StringIO()
+ self.mock(git_cl.sys, 'stdout', out)
+ self.assertEqual(0, git_cl.main(['try']))
+ self.assertEqual(
+ out.getvalue(),
+ 'scheduled CQ Dry Run on https://codereview.chromium.org/123\n')
+
def _common_GerritCommitMsgHookCheck(self):
self.mock(git_cl.sys, 'stdout', StringIO.StringIO())
self.mock(git_cl.os.path, 'abspath',
« 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