Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / chromite / scripts / cros_best_revision_unittest.py
index 285b4bd..c7402c8 100755 (executable)
@@ -1,11 +1,12 @@
 #!/usr/bin/python
-
 # Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """Unit tests for the cros_best_revision program."""
 
+from __future__ import print_function
+
 import os
 import sys
 
@@ -18,7 +19,6 @@ from chromite.cbuildbot import manifest_version
 from chromite.cbuildbot import tree_status
 from chromite.lib import cros_build_lib_unittest
 from chromite.lib import cros_test_lib
-from chromite.lib import gclient
 from chromite.lib import gs_unittest
 from chromite.lib import osutils
 from chromite.lib import partial_mock
@@ -32,7 +32,7 @@ class BaseChromeCommitterTest(cros_test_lib.MockTempDirTestCase):
   def setUp(self):
     """Common set up method for all tests."""
     self.committer = cros_best_revision.ChromeCommitter(self.tempdir, False)
-    self.lkgm_file = os.path.join(self.tempdir, constants.CHROME_LKGM_FILE)
+    self.lkgm_file = os.path.join(self.tempdir, constants.PATH_TO_CHROME_LKGM)
     self.pass_status = manifest_version.BuilderStatus(
         manifest_version.BuilderStatus.STATUS_PASSED, None)
     self.fail_status = manifest_version.BuilderStatus(
@@ -69,13 +69,10 @@ class ChromeCommitterTester(cros_build_lib_unittest.RunCommandTestCase,
     "Tests that we can read/obtain the old LKGM from mocked out SVN."
     # Write out an old lkgm file as if we got it from svn update.
     old_lkgm = '2098.0.0'
+    osutils.SafeMakedirs(os.path.dirname(self.lkgm_file))
     osutils.WriteFile(self.lkgm_file, old_lkgm)
     self.committer.CheckoutChromeLKGM()
     self.assertTrue(self.committer._old_lkgm, old_lkgm)
-    self.assertCommandContains([
-        '%s/%s' % (gclient.CHROME_COMMITTER_URL,
-                   os.path.dirname(constants.SVN_CHROME_LKGM))])
-    self.assertCommandContains([constants.CHROME_LKGM_FILE])
 
   def _TestFindNewLKGM(self, all_results, lkgm):
     """Stubs out methods used by FindNewLKGM."""
@@ -118,14 +115,14 @@ class ChromeCommitterTester(cros_build_lib_unittest.RunCommandTestCase,
 
   def testCommitNewLKGM(self):
     """Tests that we can commit a new LKGM file."""
+    osutils.SafeMakedirs(os.path.dirname(self.lkgm_file))
     self.committer._lkgm = '4.0.0'
     self.PatchObject(tree_status, 'IsTreeOpen', return_value=True)
     self.committer.CommitNewLKGM()
 
     # Check the file was actually written out correctly.
     self.assertEqual(osutils.ReadFile(self.lkgm_file), self.committer._lkgm)
-    self.assertCommandContains([constants.CHROME_LKGM_FILE])
-    self.assertCommandContains(['commit'])
+    self.assertCommandContains(['git', 'cl', 'land'])
 
 
 if __name__ == '__main__':