| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Unit tests for gclient_scm.py.""" | 6 """Unit tests for gclient_scm.py.""" |
| 7 | 7 |
| 8 # Import before super_mox to keep valid references. | 8 # Import before super_mox to keep valid references. |
| 9 from os import rename | 9 from os import rename |
| 10 from shutil import rmtree | 10 from shutil import rmtree |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 def setUp(self): | 62 def setUp(self): |
| 63 BaseTestCase.setUp(self) | 63 BaseTestCase.setUp(self) |
| 64 self.root_dir = self.Dir() | 64 self.root_dir = self.Dir() |
| 65 self.args = self.Args() | 65 self.args = self.Args() |
| 66 self.url = self.Url() | 66 self.url = self.Url() |
| 67 self.relpath = 'asf' | 67 self.relpath = 'asf' |
| 68 | 68 |
| 69 def testDir(self): | 69 def testDir(self): |
| 70 members = [ | 70 members = [ |
| 71 'FullUrlForRelativeUrl', 'RunCommand', | 71 'AddAdditionalFlags', 'FullUrlForRelativeUrl', 'RunCommand', |
| 72 'cleanup', 'diff', 'export', 'pack', 'relpath', 'revert', | 72 'cleanup', 'diff', 'export', 'pack', 'relpath', 'revert', |
| 73 'revinfo', 'runhooks', 'scm_name', 'status', 'update', | 73 'revinfo', 'runhooks', 'scm_name', 'status', 'update', |
| 74 'updatesingle', 'url', | 74 'updatesingle', 'url', |
| 75 ] | 75 ] |
| 76 | 76 |
| 77 # If you add a member, be sure to add the relevant test! | 77 # If you add a member, be sure to add the relevant test! |
| 78 self.compareMembers(self._scm_wrapper(), members) | 78 self.compareMembers(self._scm_wrapper(), members) |
| 79 | 79 |
| 80 def testUnsupportedSCM(self): | 80 def testUnsupportedSCM(self): |
| 81 args = [self.url, self.root_dir, self.relpath] | 81 args = [self.url, self.root_dir, self.relpath] |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 # Checkout or update. | 259 # Checkout or update. |
| 260 gclient_scm.os.path.exists(base_path).AndReturn(True) | 260 gclient_scm.os.path.exists(base_path).AndReturn(True) |
| 261 gclient_scm.scm.SVN.CaptureInfo( | 261 gclient_scm.scm.SVN.CaptureInfo( |
| 262 gclient_scm.os.path.join(base_path, "."), '.' | 262 gclient_scm.os.path.join(base_path, "."), '.' |
| 263 ).AndReturn(file_info) | 263 ).AndReturn(file_info) |
| 264 # Cheat a bit here. | 264 # Cheat a bit here. |
| 265 gclient_scm.scm.SVN.CaptureInfo(file_info['URL'], '.').AndReturn(file_info) | 265 gclient_scm.scm.SVN.CaptureInfo(file_info['URL'], '.').AndReturn(file_info) |
| 266 additional_args = [] | 266 additional_args = [] |
| 267 if options.manually_grab_svn_rev: | 267 if options.manually_grab_svn_rev: |
| 268 additional_args = ['--revision', str(file_info['Revision'])] | 268 additional_args = ['--revision', str(file_info['Revision'])] |
| 269 if options.force: |
| 270 additional_args.append('--force') |
| 269 files_list = [] | 271 files_list = [] |
| 270 gclient_scm.scm.SVN.RunAndGetFileList( | 272 gclient_scm.scm.SVN.RunAndGetFileList( |
| 271 options, | 273 options, |
| 272 ['update', base_path] + additional_args, | 274 ['update', base_path] + additional_args, |
| 273 self.root_dir, files_list) | 275 self.root_dir, files_list) |
| 274 | 276 |
| 275 self.mox.ReplayAll() | 277 self.mox.ReplayAll() |
| 276 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, | 278 scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir, |
| 277 relpath=self.relpath) | 279 relpath=self.relpath) |
| 278 scm.update(options, (), files_list) | 280 scm.update(options, (), files_list) |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 relpath=self.relpath) | 736 relpath=self.relpath) |
| 735 rev_info = scm.revinfo(options, (), None) | 737 rev_info = scm.revinfo(options, (), None) |
| 736 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458') | 738 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458') |
| 737 | 739 |
| 738 | 740 |
| 739 if __name__ == '__main__': | 741 if __name__ == '__main__': |
| 740 import unittest | 742 import unittest |
| 741 unittest.main() | 743 unittest.main() |
| 742 | 744 |
| 743 # vim: ts=2:sw=2:tw=80:et: | 745 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |