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 | |
9 import unittest | 8 import unittest |
10 | 9 |
11 # Local imports | 10 # Local imports |
12 import super_mox | 11 import super_mox |
13 import trychange | 12 import trychange |
14 from super_mox import mox | 13 from super_mox import mox |
15 | 14 |
16 | 15 |
17 class TryChangeTestsBase(super_mox.SuperMoxTestBase): | 16 class TryChangeTestsBase(super_mox.SuperMoxTestBase): |
18 """Setups and tear downs the mocks but doesn't test anything as-is.""" | 17 """Setups and tear downs the mocks but doesn't test anything as-is.""" |
19 pass | 18 pass |
20 | 19 |
21 | 20 |
22 class TryChangeUnittest(TryChangeTestsBase): | 21 class TryChangeUnittest(TryChangeTestsBase): |
23 """General trychange.py tests.""" | 22 """General trychange.py tests.""" |
24 def testMembersChanged(self): | 23 def testMembersChanged(self): |
25 members = [ | 24 members = [ |
26 'EscapeDot', 'ExecuteTryServerScript', 'GIT', 'GetSourceRoot', 'GuessVCS', | 25 'EscapeDot', 'GIT', 'GetSourceRoot', |
| 26 'GetTryServerSettings', 'GuessVCS', |
27 'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'PathDifference', | 27 'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'PathDifference', |
28 'RunCommand', 'SCM', 'SCRIPT_PATH', 'SVN', 'TryChange', 'USAGE', | 28 'RunCommand', 'SCM', 'SVN', 'TryChange', 'USAGE', |
29 'datetime', 'gcl', 'gclient', 'getpass', 'logging', 'optparse', 'os', | 29 'datetime', 'gcl', 'gclient', 'getpass', 'logging', 'optparse', 'os', |
30 'shutil', 'sys', 'tempfile', 'traceback', 'urllib', | 30 'shutil', 'socket', 'sys', 'tempfile', 'traceback', 'upload', '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 """General trychange.py tests.""" | 37 """trychange.SVN 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 TryChangeUnittest(TryChangeTestsBase): | 46 class GITUnittest(TryChangeTestsBase): |
47 """General trychange.py tests.""" | 47 """trychange.GIT 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 |