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 optparse | 8 import optparse |
9 import unittest | 9 import unittest |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 | 23 |
24 class TryChangeUnittest(TryChangeTestsBase): | 24 class TryChangeUnittest(TryChangeTestsBase): |
25 """General trychange.py tests.""" | 25 """General trychange.py tests.""" |
26 def testMembersChanged(self): | 26 def testMembersChanged(self): |
27 members = [ | 27 members = [ |
28 'EscapeDot', 'GIT', 'GetSourceRoot', | 28 'EscapeDot', 'GIT', 'GetSourceRoot', |
29 'GetTryServerSettings', 'GuessVCS', | 29 'GetTryServerSettings', 'GuessVCS', |
30 'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'PathDifference', | 30 'HELP_STRING', 'InvalidScript', 'NoTryServerAccess', 'PathDifference', |
31 'RunCommand', 'SCM', 'SVN', 'TryChange', 'USAGE', | 31 'RunCommand', 'SCM', 'SVN', 'TryChange', 'USAGE', |
32 'datetime', 'gcl', 'gclient', 'gclient_scm', 'getpass', 'logging', | 32 'datetime', 'gcl', 'gclient_scm', 'getpass', 'logging', |
33 'optparse', 'os', 'presubmit_support', 'shutil', 'socket', 'subprocess', | 33 'optparse', 'os', 'presubmit_support', 'shutil', 'socket', 'subprocess', |
34 'sys', 'tempfile', 'traceback', 'upload', 'urllib', | 34 'sys', 'tempfile', 'upload', 'urllib', |
35 ] | 35 ] |
36 # If this test fails, you should add the relevant test. | 36 # If this test fails, you should add the relevant test. |
37 self.compareMembers(trychange, members) | 37 self.compareMembers(trychange, members) |
38 | 38 |
39 | 39 |
40 class SVNUnittest(TryChangeTestsBase): | 40 class SVNUnittest(TryChangeTestsBase): |
41 """trychange.SVN tests.""" | 41 """trychange.SVN tests.""" |
42 def setUp(self): | 42 def setUp(self): |
43 self.fake_root = '/fake_root' | 43 self.fake_root = '/fake_root' |
44 self.expected_files = ['foo.txt', 'bar.txt'] | 44 self.expected_files = ['foo.txt', 'bar.txt'] |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 def testGetLocalRoot(self): | 92 def testGetLocalRoot(self): |
93 self.mox.StubOutWithMock(upload, 'RunShell') | 93 self.mox.StubOutWithMock(upload, 'RunShell') |
94 upload.RunShell(['git', 'rev-parse', '--show-cdup']).AndReturn( | 94 upload.RunShell(['git', 'rev-parse', '--show-cdup']).AndReturn( |
95 self.fake_root) | 95 self.fake_root) |
96 self.mox.ReplayAll() | 96 self.mox.ReplayAll() |
97 self.assertEqual(self.git.GetLocalRoot(), self.fake_root) | 97 self.assertEqual(self.git.GetLocalRoot(), self.fake_root) |
98 | 98 |
99 | 99 |
100 if __name__ == '__main__': | 100 if __name__ == '__main__': |
101 unittest.main() | 101 unittest.main() |
OLD | NEW |