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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 def setUp(self): | 52 def setUp(self): |
53 BaseTestCase.setUp(self) | 53 BaseTestCase.setUp(self) |
54 self.root_dir = self.Dir() | 54 self.root_dir = self.Dir() |
55 self.args = self.Args() | 55 self.args = self.Args() |
56 self.url = self.Url() | 56 self.url = self.Url() |
57 self.relpath = 'asf' | 57 self.relpath = 'asf' |
58 | 58 |
59 def testDir(self): | 59 def testDir(self): |
60 members = [ | 60 members = [ |
61 'COMMAND', 'Capture', 'CaptureHeadRevision', 'CaptureInfo', | 61 'FullUrlForRelativeUrl', 'RunCommand', |
62 'CaptureStatus', 'DiffItem', 'GenerateDiff', 'GetCheckoutRoot', | 62 'cleanup', 'diff', 'export', 'pack', 'relpath', 'revert', |
63 'GetEmail', 'GetFileProperty', 'FullUrlForRelativeUrl', 'IsMoved', | |
64 'ReadSimpleAuth', 'Run', 'RunAndFilterOutput', 'RunAndGetFileList', | |
65 'RunCommand', 'cleanup', 'diff', 'export', 'pack', 'relpath', 'revert', | |
66 'revinfo', 'runhooks', 'scm_name', 'status', 'update', 'url', | 63 'revinfo', 'runhooks', 'scm_name', 'status', 'update', 'url', |
67 ] | 64 ] |
68 | 65 |
69 # If you add a member, be sure to add the relevant test! | 66 # If you add a member, be sure to add the relevant test! |
70 self.compareMembers(self._scm_wrapper(), members) | 67 self.compareMembers(self._scm_wrapper(), members) |
71 | 68 |
72 def testUnsupportedSCM(self): | 69 def testUnsupportedSCM(self): |
73 args = [self.url, self.root_dir, self.relpath] | 70 args = [self.url, self.root_dir, self.relpath] |
74 kwargs = {'scm_name' : 'foo'} | 71 kwargs = {'scm_name' : 'foo'} |
75 exception_msg = 'Unsupported scm %(scm_name)s' % kwargs | 72 exception_msg = 'Unsupported scm %(scm_name)s' % kwargs |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 self.base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) | 369 self.base_path = gclient_scm.os.path.join(self.root_dir, self.relpath) |
373 self.enabled = self.CreateGitRepo(self.sample_git_import, self.base_path) | 370 self.enabled = self.CreateGitRepo(self.sample_git_import, self.base_path) |
374 SuperMoxBaseTestBase.setUp(self) | 371 SuperMoxBaseTestBase.setUp(self) |
375 | 372 |
376 def tearDown(self): | 373 def tearDown(self): |
377 SuperMoxBaseTestBase.tearDown(self) | 374 SuperMoxBaseTestBase.tearDown(self) |
378 rmtree(self.root_dir) | 375 rmtree(self.root_dir) |
379 | 376 |
380 def testDir(self): | 377 def testDir(self): |
381 members = [ | 378 members = [ |
382 'COMMAND', 'AssertVersion', 'Capture', 'CaptureStatus', | 379 'FullUrlForRelativeUrl', 'RunCommand', |
383 'FetchUpstreamTuple', | |
384 'FullUrlForRelativeUrl', 'GenerateDiff', 'GetBranch', 'GetBranchRef', | |
385 'GetCheckoutRoot', 'GetDifferentFiles', 'GetEmail', 'GetPatchName', | |
386 'GetSVNBranch', 'GetUpstream', 'IsGitSvn', 'RunAndFilterOutput', | |
387 'ShortBranchName', 'RunCommand', | |
388 'cleanup', 'diff', 'export', 'pack', 'relpath', 'revert', | 380 'cleanup', 'diff', 'export', 'pack', 'relpath', 'revert', |
389 'revinfo', 'runhooks', 'scm_name', 'status', 'update', 'url', | 381 'revinfo', 'runhooks', 'scm_name', 'status', 'update', 'url', |
390 ] | 382 ] |
391 | 383 |
392 # If you add a member, be sure to add the relevant test! | 384 # If you add a member, be sure to add the relevant test! |
393 self.compareMembers(gclient_scm.CreateSCM(url=self.url), members) | 385 self.compareMembers(gclient_scm.CreateSCM(url=self.url), members) |
394 | 386 |
395 def testRevertMissing(self): | 387 def testRevertMissing(self): |
396 if not self.enabled: | 388 if not self.enabled: |
397 return | 389 return |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 relpath=self.relpath) | 580 relpath=self.relpath) |
589 rev_info = scm.revinfo(options, (), None) | 581 rev_info = scm.revinfo(options, (), None) |
590 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458') | 582 self.assertEquals(rev_info, '069c602044c5388d2d15c3f875b057c852003458') |
591 | 583 |
592 | 584 |
593 if __name__ == '__main__': | 585 if __name__ == '__main__': |
594 import unittest | 586 import unittest |
595 unittest.main() | 587 unittest.main() |
596 | 588 |
597 # vim: ts=2:sw=2:tw=80:et: | 589 # vim: ts=2:sw=2:tw=80:et: |
OLD | NEW |