OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2009 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 unittest | 9 import unittest |
9 | 10 |
10 # Local imports | 11 # Local imports |
11 import super_mox | 12 import super_mox |
12 import trychange | 13 import trychange |
13 from super_mox import mox | 14 from super_mox import mox |
14 | 15 |
15 | 16 |
16 class TryChangeTestsBase(super_mox.SuperMoxTestBase): | 17 class TryChangeTestsBase(super_mox.SuperMoxTestBase): |
17 """Setups and tear downs the mocks but doesn't test anything as-is.""" | 18 """Setups and tear downs the mocks but doesn't test anything as-is.""" |
18 pass | 19 pass |
19 | 20 |
20 | 21 |
21 class TryChangeUnittest(TryChangeTestsBase): | 22 class TryChangeUnittest(TryChangeTestsBase): |
22 """General trychange.py tests.""" | 23 """General trychange.py tests.""" |
23 def testMembersChanged(self): | 24 def testMembersChanged(self): |
24 members = [ | 25 members = [ |
25 'EscapeDot', 'GIT', 'GetSourceRoot', | 26 'EscapeDot', 'ExecuteTryServerScript', 'GIT', 'GetSourceRoot', 'GuessVCS', |
26 'GetTryServerSettings', 'GuessVCS', | |
27 'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'PathDifference', | 27 'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'PathDifference', |
28 'RunCommand', 'SCM', 'SVN', 'TryChange', 'USAGE', | 28 'RunCommand', 'SCM', 'SCRIPT_PATH', 'SVN', 'TryChange', 'USAGE', |
29 'datetime', 'gcl', 'gclient', 'getpass', 'logging', 'optparse', 'os', | 29 'datetime', 'gcl', 'gclient', 'getpass', 'logging', 'optparse', 'os', |
30 'shutil', 'socket', 'sys', 'tempfile', 'traceback', 'upload', 'urllib', | 30 'shutil', 'sys', 'tempfile', 'traceback', 'urllib', |
31 ] | 31 ] |
32 # If this test fails, you should add the relevant test. | 32 # If this test fails, you should add the relevant test. |
33 self.compareMembers(trychange, members) | 33 self.compareMembers(trychange, members) |
34 | 34 |
35 | 35 |
36 class SVNUnittest(TryChangeTestsBase): | 36 class SVNUnittest(TryChangeTestsBase): |
37 """trychange.SVN tests.""" | 37 """General trychange.py tests.""" |
38 def testMembersChanged(self): | 38 def testMembersChanged(self): |
39 members = [ | 39 members = [ |
40 'GenerateDiff', 'ProcessOptions', 'options' | 40 'GenerateDiff', 'ProcessOptions', 'options' |
41 ] | 41 ] |
42 # If this test fails, you should add the relevant test. | 42 # If this test fails, you should add the relevant test. |
43 self.compareMembers(trychange.SVN(None), members) | 43 self.compareMembers(trychange.SVN(None), members) |
44 | 44 |
45 | 45 |
46 class GITUnittest(TryChangeTestsBase): | 46 class TryChangeUnittest(TryChangeTestsBase): |
47 """trychange.GIT tests.""" | 47 """General trychange.py tests.""" |
48 def testMembersChanged(self): | 48 def testMembersChanged(self): |
49 members = [ | 49 members = [ |
50 'GenerateDiff', 'GetEmail', 'GetPatchName', 'ProcessOptions', 'options' | 50 'GenerateDiff', 'GetEmail', 'GetPatchName', 'ProcessOptions', 'options' |
51 ] | 51 ] |
52 # If this test fails, you should add the relevant test. | 52 # If this test fails, you should add the relevant test. |
53 self.compareMembers(trychange.GIT(None), members) | 53 self.compareMembers(trychange.GIT(None), members) |
54 | 54 |
55 | 55 |
56 if __name__ == '__main__': | 56 if __name__ == '__main__': |
57 unittest.main() | 57 unittest.main() |
OLD | NEW |