Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 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 # pylint: disable=E1103 | 8 # pylint: disable=E1103 |
| 9 | 9 |
| 10 # Import before super_mox to keep valid references. | 10 # Import before super_mox to keep valid references. |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 | 86 |
| 87 def Options(self, *args, **kwargs): | 87 def Options(self, *args, **kwargs): |
| 88 return self.OptionsObject(*args, **kwargs) | 88 return self.OptionsObject(*args, **kwargs) |
| 89 | 89 |
| 90 def setUp(self): | 90 def setUp(self): |
| 91 BaseTestCase.setUp(self) | 91 BaseTestCase.setUp(self) |
| 92 self.url = self.SvnUrl() | 92 self.url = self.SvnUrl() |
| 93 | 93 |
| 94 def testDir(self): | 94 def testDir(self): |
| 95 members = [ | 95 members = [ |
| 96 'FullUrlForRelativeUrl', 'GetRevisionDate', 'RunCommand', | 96 'FullUrlForRelativeUrl', |
| 97 'cleanup', 'diff', 'pack', 'relpath', 'revert', | 97 'GetRevisionDate', |
| 98 'revinfo', 'runhooks', 'status', 'update', | 98 'GetUsableRev', |
| 99 'updatesingle', 'url', | 99 'RunCommand', |
| 100 'cleanup', | |
| 101 'diff', | |
| 102 'pack', | |
| 103 'relpath', | |
| 104 'revert', | |
| 105 'revinfo', | |
| 106 'runhooks', | |
| 107 'status', | |
| 108 'update', | |
| 109 'updatesingle', | |
| 110 'url' | |
|
M-A Ruel
2011/12/16 15:03:31
keep a coma there so it's easier to add another va
Dan Beam
2011/12/16 18:05:53
Done.
| |
| 100 ] | 111 ] |
| 101 | 112 |
| 102 # If you add a member, be sure to add the relevant test! | 113 # If you add a member, be sure to add the relevant test! |
| 103 self.compareMembers(self._scm_wrapper('svn://a'), members) | 114 self.compareMembers(self._scm_wrapper('svn://a'), members) |
| 104 | 115 |
| 105 def testUnsupportedSCM(self): | 116 def testUnsupportedSCM(self): |
| 106 args = ['gopher://foo', self.root_dir, self.relpath] | 117 args = ['gopher://foo', self.root_dir, self.relpath] |
| 107 exception_msg = 'No SCM found for url gopher://foo' | 118 exception_msg = 'No SCM found for url gopher://foo' |
| 108 self.assertRaisesError(exception_msg, self._scm_wrapper, *args) | 119 self.assertRaisesError(exception_msg, self._scm_wrapper, *args) |
| 109 | 120 |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 639 self.base_path = join(self.root_dir, self.relpath) | 650 self.base_path = join(self.root_dir, self.relpath) |
| 640 self.enabled = self.CreateGitRepo(self.sample_git_import, self.base_path) | 651 self.enabled = self.CreateGitRepo(self.sample_git_import, self.base_path) |
| 641 StdoutCheck.setUp(self) | 652 StdoutCheck.setUp(self) |
| 642 | 653 |
| 643 def tearDown(self): | 654 def tearDown(self): |
| 644 StdoutCheck.tearDown(self) | 655 StdoutCheck.tearDown(self) |
| 645 TestCaseUtils.tearDown(self) | 656 TestCaseUtils.tearDown(self) |
| 646 unittest.TestCase.tearDown(self) | 657 unittest.TestCase.tearDown(self) |
| 647 rmtree(self.root_dir) | 658 rmtree(self.root_dir) |
| 648 | 659 |
| 649 | |
| 650 class ManagedGitWrapperTestCase(BaseGitWrapperTestCase): | 660 class ManagedGitWrapperTestCase(BaseGitWrapperTestCase): |
| 651 def testDir(self): | 661 def testDir(self): |
| 652 members = [ | 662 members = [ |
| 653 'FullUrlForRelativeUrl', 'GetRevisionDate', 'RunCommand', | 663 'FullUrlForRelativeUrl', |
| 654 'cleanup', 'diff', 'pack', 'relpath', 'revert', | 664 'GetRevisionDate', |
| 655 'revinfo', 'runhooks', 'status', 'update', 'url', | 665 'GetUsableRev', |
| 666 'RunCommand', | |
| 667 'cleanup', | |
| 668 'diff', | |
| 669 'pack', | |
| 670 'relpath', | |
| 671 'revert', | |
| 672 'revinfo', | |
| 673 'runhooks', | |
| 674 'status', | |
| 675 'update', | |
| 676 'url' | |
|
M-A Ruel
2011/12/16 15:03:31
same
Dan Beam
2011/12/16 18:05:53
Done.
| |
| 656 ] | 677 ] |
| 657 | 678 |
| 658 # If you add a member, be sure to add the relevant test! | 679 # If you add a member, be sure to add the relevant test! |
| 659 self.compareMembers(gclient_scm.CreateSCM(url=self.url), members) | 680 self.compareMembers(gclient_scm.CreateSCM(url=self.url), members) |
| 660 | 681 |
| 661 def testRevertMissing(self): | 682 def testRevertMissing(self): |
| 662 if not self.enabled: | 683 if not self.enabled: |
| 663 return | 684 return |
| 664 options = self.Options() | 685 options = self.Options() |
| 665 file_path = join(self.base_path, 'a') | 686 file_path = join(self.base_path, 'a') |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 991 | 1012 |
| 992 if __name__ == '__main__': | 1013 if __name__ == '__main__': |
| 993 if '-v' in sys.argv: | 1014 if '-v' in sys.argv: |
| 994 logging.basicConfig( | 1015 logging.basicConfig( |
| 995 level=logging.DEBUG, | 1016 level=logging.DEBUG, |
| 996 format='%(asctime).19s %(levelname)s %(filename)s:' | 1017 format='%(asctime).19s %(levelname)s %(filename)s:' |
| 997 '%(lineno)s %(message)s') | 1018 '%(lineno)s %(message)s') |
| 998 unittest.main() | 1019 unittest.main() |
| 999 | 1020 |
| 1000 # vim: ts=2:sw=2:tw=80:et: | 1021 # vim: ts=2:sw=2:tw=80:et: |
| OLD | NEW |