def testMarkAndroidEBuildAsStable(self):
   """Test updating of ebuild."""
   self.PatchObject(cros_build_lib, 'RunCommand')
   self.PatchObject(portage_util.EBuild, 'GetCrosWorkonVars',
                    return_value=None)
   git_mock = self.PatchObject(git, 'RunGit')
   commit_mock = self.PatchObject(portage_util.EBuild, 'CommitChange')
   stable_candidate = portage_util.EBuild(self.old2)
   unstable = portage_util.EBuild(self.unstable)
   android_version = self.new_version
   package_dir = self.mock_android_dir
   version_atom = cros_mark_android_as_stable.MarkAndroidEBuildAsStable(
       stable_candidate, unstable, self.android_package, android_version,
       package_dir, self.build_branch, self.arc_bucket_url,
       self.targets)
   git_mock.assert_has_calls([
       mock.call(package_dir, ['add', self.new]),
       mock.call(package_dir, ['add', 'Manifest']),
   ])
   commit_mock.assert_called_with(partial_mock.HasString('latest'),
                                  package_dir)
   self.assertEqual(
       version_atom,
       '%s-%s-r1' % (
           portage_util.GetFullAndroidPortagePackageName(self.android_package),
           self.new_version))
 def testMarkAndroidEBuildAsStable(self):
     """Test updating of ebuild."""
     self.PatchObject(cros_build_lib, 'RunCommand')
     git_mock = self.PatchObject(git, 'RunGit')
     commit_mock = self.PatchObject(portage_util.EBuild, 'CommitChange')
     stable_candidate = portage_util.EBuild(self.old2)
     unstable = portage_util.EBuild(self.unstable)
     android_version = self.new_version
     package_dir = self.mock_android_dir
     version_atom = cros_mark_android_as_stable.MarkAndroidEBuildAsStable(
         stable_candidate, unstable, constants.ANDROID_PN, android_version,
         package_dir, self.build_branch, self.arc_bucket_url)
     git_mock.assert_has_calls([
         mock.call(package_dir, ['add', self.new]),
         mock.call(package_dir, ['add', 'Manifest']),
     ])
     commit_mock.assert_call(mock.call('latest', package_dir))
     self.assertEqual(version_atom,
                      '%s-%s-r1' % (constants.ANDROID_CP, self.new_version))