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 29 matching lines...) Expand all Loading... |
40 self.options.name = None | 40 self.options.name = None |
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', 'GetMungedDiff', 'GuessVCS', | 49 'DieWithError', 'EPILOG', 'Escape', 'GIT', 'GetMungedDiff', 'GuessVCS', |
50 'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'OptionParser', | 50 'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'PrintSuccess', |
51 'PrintSuccess', | |
52 'RunCommand', 'RunGit', 'SCM', 'SVN', 'TryChange', 'USAGE', 'breakpad', | 51 'RunCommand', 'RunGit', 'SCM', 'SVN', 'TryChange', 'USAGE', 'breakpad', |
53 'datetime', 'errno', 'fix_encoding', 'gcl', 'gclient_utils', 'gen_parser', | 52 'datetime', 'errno', 'fix_encoding', 'gcl', 'gclient_utils', 'gen_parser', |
54 'getpass', 'json', 'logging', 'optparse', 'os', 'posixpath', 're', 'scm', | 53 'getpass', 'json', 'logging', 'optparse', 'os', 'posixpath', 're', 'scm', |
55 'shutil', 'subprocess2', 'sys', 'tempfile', 'urllib'] | 54 'shutil', 'subprocess2', 'sys', 'tempfile', 'urllib'] |
56 # If this test fails, you should add the relevant test. | 55 # If this test fails, you should add the relevant test. |
57 self.compareMembers(trychange, members) | 56 self.compareMembers(trychange, members) |
58 | 57 |
59 | 58 |
60 class TryChangeSimpleTest(unittest.TestCase): | 59 class TryChangeSimpleTest(unittest.TestCase): |
61 # Doesn't require supermox to run. | 60 # Doesn't require supermox to run. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 trychange.scm.GIT.GetEmail(self.fake_root).AndReturn('georges@example.com') | 145 trychange.scm.GIT.GetEmail(self.fake_root).AndReturn('georges@example.com') |
147 self.mox.ReplayAll() | 146 self.mox.ReplayAll() |
148 git = trychange.GIT(self.options, self.fake_root, self.options.files) | 147 git = trychange.GIT(self.options, self.fake_root, self.options.files) |
149 self.assertEqual(git.GetFileNames(), self.expected_files) | 148 self.assertEqual(git.GetFileNames(), self.expected_files) |
150 self.assertEqual(git.checkout_root, self.fake_root) | 149 self.assertEqual(git.checkout_root, self.fake_root) |
151 self.assertEqual(git.GenerateDiff(), 'A diff') | 150 self.assertEqual(git.GenerateDiff(), 'A diff') |
152 | 151 |
153 | 152 |
154 if __name__ == '__main__': | 153 if __name__ == '__main__': |
155 unittest.main() | 154 unittest.main() |
OLD | NEW |