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 unittest | 8 import unittest |
9 | 9 |
10 # Local imports | 10 # Local imports |
11 import super_mox | 11 import super_mox |
12 import trychange | 12 import trychange |
13 from super_mox import mox | 13 from super_mox import mox |
14 | 14 |
15 | 15 |
16 class TryChangeTestsBase(super_mox.SuperMoxTestBase): | 16 class TryChangeTestsBase(super_mox.SuperMoxTestBase): |
17 """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.""" |
18 pass | 18 pass |
19 | 19 |
20 | 20 |
21 class TryChangeUnittest(TryChangeTestsBase): | 21 class TryChangeUnittest(TryChangeTestsBase): |
22 """General trychange.py tests.""" | 22 """General trychange.py tests.""" |
23 def testMembersChanged(self): | 23 def testMembersChanged(self): |
24 members = [ | 24 members = [ |
25 'EscapeDot', 'GIT', 'GetSourceRoot', | 25 'EscapeDot', 'GIT', 'GetSourceRoot', |
26 'GetTryServerSettings', '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', 'SVN', 'TryChange', 'USAGE', |
29 'datetime', 'gcl', 'gclient', 'getpass', 'logging', 'optparse', 'os', | 29 'datetime', 'gcl', 'gclient', 'gclient_scm', 'getpass', 'logging', |
30 'shutil', 'socket', 'sys', 'tempfile', 'traceback', 'upload', 'urllib', | 30 'optparse', 'os', 'shutil', 'socket', 'sys', 'tempfile', 'traceback', |
| 31 'upload', 'urllib', |
31 ] | 32 ] |
32 # If this test fails, you should add the relevant test. | 33 # If this test fails, you should add the relevant test. |
33 self.compareMembers(trychange, members) | 34 self.compareMembers(trychange, members) |
34 | 35 |
35 | 36 |
36 class SVNUnittest(TryChangeTestsBase): | 37 class SVNUnittest(TryChangeTestsBase): |
37 """trychange.SVN tests.""" | 38 """trychange.SVN tests.""" |
38 def testMembersChanged(self): | 39 def testMembersChanged(self): |
39 members = [ | 40 members = [ |
40 'GenerateDiff', 'ProcessOptions', 'options' | 41 'GenerateDiff', 'ProcessOptions', 'options' |
41 ] | 42 ] |
42 # If this test fails, you should add the relevant test. | 43 # If this test fails, you should add the relevant test. |
43 self.compareMembers(trychange.SVN(None), members) | 44 self.compareMembers(trychange.SVN(None), members) |
44 | 45 |
45 | 46 |
46 class GITUnittest(TryChangeTestsBase): | 47 class GITUnittest(TryChangeTestsBase): |
47 """trychange.GIT tests.""" | 48 """trychange.GIT tests.""" |
48 def testMembersChanged(self): | 49 def testMembersChanged(self): |
49 members = [ | 50 members = [ |
50 'GenerateDiff', 'GetEmail', 'GetPatchName', 'ProcessOptions', 'options' | 51 'GenerateDiff', 'GetEmail', 'GetPatchName', 'ProcessOptions', 'options' |
51 ] | 52 ] |
52 # If this test fails, you should add the relevant test. | 53 # If this test fails, you should add the relevant test. |
53 self.compareMembers(trychange.GIT(None), members) | 54 self.compareMembers(trychange.GIT(None), members) |
54 | 55 |
55 | 56 |
56 if __name__ == '__main__': | 57 if __name__ == '__main__': |
57 unittest.main() | 58 unittest.main() |
OLD | NEW |