| 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 git_cl.py.""" | 6 """Unit tests for git_cl.py.""" |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import StringIO | 9 import StringIO |
| 10 import stat | 10 import stat |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 return os.path.join(src_dir, path) | 424 return os.path.join(src_dir, path) |
| 425 return path | 425 return path |
| 426 self.mock(git_cl.os.path, 'abspath', AbsPath) | 426 self.mock(git_cl.os.path, 'abspath', AbsPath) |
| 427 commit_msg_path = os.path.join(src_dir, '.git', 'hooks', 'commit-msg') | 427 commit_msg_path = os.path.join(src_dir, '.git', 'hooks', 'commit-msg') |
| 428 def Exists(path): | 428 def Exists(path): |
| 429 if path == commit_msg_path: | 429 if path == commit_msg_path: |
| 430 return False | 430 return False |
| 431 # others paths, such as /usr/share/locale/.... | 431 # others paths, such as /usr/share/locale/.... |
| 432 return True | 432 return True |
| 433 self.mock(git_cl.os.path, 'exists', Exists) | 433 self.mock(git_cl.os.path, 'exists', Exists) |
| 434 self.mock(git_cl.urllib, 'urlretrieve', self._mocked_call) | 434 self.mock(git_cl, 'urlretrieve', self._mocked_call) |
| 435 self.calls = [ | 435 self.calls = [ |
| 436 ((['git', 'config', 'rietveld.server', 'gerrit.chromium.org'],), ''), | 436 ((['git', 'config', 'rietveld.server', 'gerrit.chromium.org'],), ''), |
| 437 ((['git', 'config', '--unset-all', 'rietveld.cc'],), ''), | 437 ((['git', 'config', '--unset-all', 'rietveld.cc'],), ''), |
| 438 ((['git', 'config', '--unset-all', 'rietveld.tree-status-url'],), ''), | 438 ((['git', 'config', '--unset-all', 'rietveld.tree-status-url'],), ''), |
| 439 ((['git', 'config', '--unset-all', 'rietveld.viewvc-url'],), ''), | 439 ((['git', 'config', '--unset-all', 'rietveld.viewvc-url'],), ''), |
| 440 ((['git', 'config', 'gerrit.host', 'gerrit.chromium.org'],), ''), | 440 ((['git', 'config', 'gerrit.host', 'gerrit.chromium.org'],), ''), |
| 441 ((['git', 'config', 'gerrit.port', '29418'],), ''), | 441 ((['git', 'config', 'gerrit.port', '29418'],), ''), |
| 442 # DownloadHooks(False) | 442 # DownloadHooks(False) |
| 443 ((['git', 'config', 'gerrit.host'],), 'gerrit.chromium.org'), | 443 ((['git', 'config', 'gerrit.host'],), 'gerrit.chromium.org'), |
| 444 ((['git', 'config', 'rietveld.server'],), 'gerrit.chromium.org'), | 444 ((['git', 'config', 'rietveld.server'],), 'gerrit.chromium.org'), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 458 ((['git', 'config', 'rietveld.viewvc-url'],), ''), | 458 ((['git', 'config', 'rietveld.viewvc-url'],), ''), |
| 459 (('ViewVC URL:',), ''), | 459 (('ViewVC URL:',), ''), |
| 460 # DownloadHooks(True) | 460 # DownloadHooks(True) |
| 461 ((commit_msg_path, os.X_OK,), True), | 461 ((commit_msg_path, os.X_OK,), True), |
| 462 ] | 462 ] |
| 463 git_cl.main(['config']) | 463 git_cl.main(['config']) |
| 464 | 464 |
| 465 | 465 |
| 466 if __name__ == '__main__': | 466 if __name__ == '__main__': |
| 467 unittest.main() | 467 unittest.main() |
| OLD | NEW |