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 trychange.py.""" | 6 """Unit tests for trychange.py.""" |
7 | 7 |
8 # Fixes include path. | 8 # Fixes include path. |
9 from super_mox import mox, SuperMoxTestBase | 9 from super_mox import mox, SuperMoxTestBase |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 self.options.diff = None | 33 self.options.diff = None |
34 self.options.name = None | 34 self.options.name = None |
35 self.options.email = None | 35 self.options.email = None |
36 self.options.exclude = [] | 36 self.options.exclude = [] |
37 | 37 |
38 | 38 |
39 class TryChangeUnittest(TryChangeTestsBase): | 39 class TryChangeUnittest(TryChangeTestsBase): |
40 """General trychange.py tests.""" | 40 """General trychange.py tests.""" |
41 def testMembersChanged(self): | 41 def testMembersChanged(self): |
42 members = [ | 42 members = [ |
43 'EPILOG', 'EscapeDot', 'GIT', 'GuessVCS', 'GetMungedDiff', | 43 'EPILOG', 'EscapeDot', 'GclGetCodeReviewSetting', 'GIT', 'GuessVCS', |
44 'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'PrintSuccess', | 44 'GetMungedDiff', 'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', |
45 'SCM', 'SVN', 'TryChange', 'USAGE', | 45 'PrintSuccess', 'SCM', 'SVN', 'TryChange', 'USAGE', |
46 'breakpad', 'datetime', 'errno', 'gclient_utils', 'getpass', 'json', | 46 'breakpad', 'datetime', 'errno', 'gcl', 'gclient_utils', 'getpass', |
47 'logging', 'optparse', 'os', 'posixpath', 're', 'scm', 'shutil', 'sys', | 47 'json', 'logging', 'optparse', 'os', 'posixpath', 're', 'scm', 'shutil', |
48 'tempfile', 'urllib', | 48 'sys', 'tempfile', 'urllib', |
49 ] | 49 ] |
50 # If this test fails, you should add the relevant test. | 50 # If this test fails, you should add the relevant test. |
51 self.compareMembers(trychange, members) | 51 self.compareMembers(trychange, members) |
52 | 52 |
53 | 53 |
54 class SVNUnittest(TryChangeTestsBase): | 54 class SVNUnittest(TryChangeTestsBase): |
55 """trychange.SVN tests.""" | 55 """trychange.SVN tests.""" |
56 def testMembersChanged(self): | 56 def testMembersChanged(self): |
57 members = [ | 57 members = [ |
58 'AutomagicalSettings', 'GetCodeReviewSetting', 'ReadRootFile', | 58 'AutomagicalSettings', 'GetCodeReviewSetting', 'ReadRootFile', |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 self.mox.ReplayAll() | 97 self.mox.ReplayAll() |
98 git = trychange.GIT(self.options, self.fake_root) | 98 git = trychange.GIT(self.options, self.fake_root) |
99 self.assertEqual(git.GetFileNames(), self.expected_files) | 99 self.assertEqual(git.GetFileNames(), self.expected_files) |
100 self.assertEqual(git.checkout_root, self.fake_root) | 100 self.assertEqual(git.checkout_root, self.fake_root) |
101 self.assertEqual(git.GenerateDiff(), 'A diff') | 101 self.assertEqual(git.GenerateDiff(), 'A diff') |
102 | 102 |
103 | 103 |
104 if __name__ == '__main__': | 104 if __name__ == '__main__': |
105 import unittest | 105 import unittest |
106 unittest.main() | 106 unittest.main() |
OLD | NEW |