summaryrefslogtreecommitdiff
path: root/scripts/cros_mark_as_stable_unittest.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cros_mark_as_stable_unittest.py')
-rw-r--r--scripts/cros_mark_as_stable_unittest.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/scripts/cros_mark_as_stable_unittest.py b/scripts/cros_mark_as_stable_unittest.py
index 9d87e1b8e..bafb1603a 100644
--- a/scripts/cros_mark_as_stable_unittest.py
+++ b/scripts/cros_mark_as_stable_unittest.py
@@ -41,6 +41,7 @@ class NonClassTests(cros_test_lib.MockTestCase):
git_log = 'Marking test_one as stable\nMarking test_two as stable\n'
fake_description = 'Marking set of ebuilds as stable\n\n%s' % git_log
+ self.PatchObject(git, 'DoesCommitExistInRepo', return_value=True)
self.PatchObject(cros_mark_as_stable, '_DoWeHaveLocalCommits',
return_value=True)
self.PatchObject(cros_mark_as_stable.GitBranch, 'CreateBranch',
@@ -56,6 +57,8 @@ class NonClassTests(cros_test_lib.MockTestCase):
create_mock = self.PatchObject(git, 'CreatePushBranch')
git_mock = self.StartPatcher(RunGitMock())
+ git_mock.AddCmdResult(['checkout', self._branch])
+
cmd = ['log', '--format=short', '--perl-regexp', '--author',
'^(?!chrome-bot)', 'refs/remotes/gerrit/master..%s' % self._branch]
@@ -72,14 +75,13 @@ class NonClassTests(cros_test_lib.MockTestCase):
git_mock.AddCmdResult(['commit', '-m', fake_description])
git_mock.AddCmdResult(['config', 'push.default', 'tracking'])
- try:
- cros_mark_as_stable.PushChange(self._branch, self._target_manifest_branch,
- False, '.')
- finally:
- sync_mock.assert_called_with('.', 'gerrit', 'refs/remotes/gerrit/master')
- if not bad_cls:
- push_mock.assert_called_with('merge_branch', '.', dryrun=False)
- create_mock.assert_called_with('merge_branch', '.')
+ cros_mark_as_stable.PushChange(self._branch, self._target_manifest_branch,
+ False, '.')
+ sync_mock.assert_called_with('.', 'gerrit', 'refs/remotes/gerrit/master')
+ if not bad_cls:
+ push_mock.assert_called_with('merge_branch', '.', dryrun=False)
+ create_mock.assert_called_with('merge_branch', '.',
+ remote_push_branch=mock.ANY)
def testPushChange(self):
"""Verify pushing changes works."""