| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 import unittest | 10 import unittest |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 self.options.email = None | 41 self.options.email = None |
| 42 self.options.exclude = [] | 42 self.options.exclude = [] |
| 43 | 43 |
| 44 | 44 |
| 45 class TryChangeUnittest(TryChangeTestsBase): | 45 class TryChangeUnittest(TryChangeTestsBase): |
| 46 """General trychange.py tests.""" | 46 """General trychange.py tests.""" |
| 47 def testMembersChanged(self): | 47 def testMembersChanged(self): |
| 48 members = [ | 48 members = [ |
| 49 'DieWithError', 'EPILOG', 'Escape', 'GIT', 'GIT_PATCH_DIR_BASENAME', | 49 'DieWithError', 'EPILOG', 'Escape', 'GIT', 'GIT_PATCH_DIR_BASENAME', |
| 50 'GetMungedDiff', 'GuessVCS', 'GIT_BRANCH_FILE', | 50 'GetMungedDiff', 'GuessVCS', 'GIT_BRANCH_FILE', |
| 51 'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'OptionParser', | 51 'HELP_STRING', 'Error', 'InvalidScript', 'NoTryServerAccess', |
| 52 'PrintSuccess', | 52 'OptionParser', 'PrintSuccess', |
| 53 'RunCommand', 'RunGit', 'SCM', 'SVN', 'TryChange', 'USAGE', 'contextlib', | 53 'RunCommand', 'RunGit', 'SCM', 'SVN', 'TryChange', 'USAGE', 'contextlib', |
| 54 'breakpad', | 54 'breakpad', |
| 55 'datetime', 'errno', 'fix_encoding', 'gcl', 'gclient_utils', 'gen_parser', | 55 'datetime', 'errno', 'fix_encoding', 'gcl', 'gclient_utils', |
| 56 'gerrit_util', 'gen_parser', |
| 56 'getpass', 'itertools', 'json', 'logging', 'optparse', 'os', 'posixpath', | 57 'getpass', 'itertools', 'json', 'logging', 'optparse', 'os', 'posixpath', |
| 57 're', 'scm', 'shutil', 'subprocess2', 'sys', 'tempfile', 'urllib', | 58 're', 'scm', 'shutil', 'subprocess2', 'sys', 'tempfile', 'urllib', |
| 58 'urllib2'] | 59 'urllib2', 'urlparse'] |
| 59 # If this test fails, you should add the relevant test. | 60 # If this test fails, you should add the relevant test. |
| 60 self.compareMembers(trychange, members) | 61 self.compareMembers(trychange, members) |
| 61 | 62 |
| 62 | 63 |
| 63 class TryChangeSimpleTest(unittest.TestCase): | 64 class TryChangeSimpleTest(unittest.TestCase): |
| 64 # Doesn't require supermox to run. | 65 # Doesn't require supermox to run. |
| 65 def test_flags(self): | 66 def test_flags(self): |
| 66 cmd = [ | 67 cmd = [ |
| 67 '--bot', 'bot1,bot2', | 68 '--bot', 'bot1,bot2', |
| 68 '--testfilter', 'test1', | 69 '--testfilter', 'test1', |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 trychange.scm.GIT.GetEmail(self.fake_root).AndReturn('georges@example.com') | 153 trychange.scm.GIT.GetEmail(self.fake_root).AndReturn('georges@example.com') |
| 153 self.mox.ReplayAll() | 154 self.mox.ReplayAll() |
| 154 git = trychange.GIT(self.options, self.fake_root, self.options.files) | 155 git = trychange.GIT(self.options, self.fake_root, self.options.files) |
| 155 self.assertEqual(git.GetFileNames(), self.expected_files) | 156 self.assertEqual(git.GetFileNames(), self.expected_files) |
| 156 self.assertEqual(git.checkout_root, self.fake_root) | 157 self.assertEqual(git.checkout_root, self.fake_root) |
| 157 self.assertEqual(git.GenerateDiff(), 'A diff') | 158 self.assertEqual(git.GenerateDiff(), 'A diff') |
| 158 | 159 |
| 159 | 160 |
| 160 if __name__ == '__main__': | 161 if __name__ == '__main__': |
| 161 unittest.main() | 162 unittest.main() |
| OLD | NEW |