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 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1950 ((['git', 'diff', 'deadbeaf'],), ''), # No diff. | 1950 ((['git', 'diff', 'deadbeaf'],), ''), # No diff. |
1951 ((['git', 'config', 'branch.feature.gerritserver'],), | 1951 ((['git', 'config', 'branch.feature.gerritserver'],), |
1952 'chromium-review.googlesource.com'), | 1952 'chromium-review.googlesource.com'), |
1953 ] | 1953 ] |
1954 cl = git_cl.Changelist(issue=123, codereview='gerrit') | 1954 cl = git_cl.Changelist(issue=123, codereview='gerrit') |
1955 cl._codereview_impl._GetChangeDetail = lambda _: { | 1955 cl._codereview_impl._GetChangeDetail = lambda _: { |
1956 'labels': {}, | 1956 'labels': {}, |
1957 'current_revision': 'deadbeaf', | 1957 'current_revision': 'deadbeaf', |
1958 } | 1958 } |
1959 cl._codereview_impl.SubmitIssue = lambda wait_for_merge: None | 1959 cl._codereview_impl.SubmitIssue = lambda wait_for_merge: None |
| 1960 out = StringIO.StringIO() |
| 1961 self.mock(sys, 'stdout', out) |
1960 self.assertEqual(0, cl.CMDLand(force=True, bypass_hooks=True, verbose=True)) | 1962 self.assertEqual(0, cl.CMDLand(force=True, bypass_hooks=True, verbose=True)) |
| 1963 self.assertRegexpMatches(out.getvalue(), 'Issue.*123 has been submitted') |
1961 | 1964 |
1962 | 1965 |
1963 if __name__ == '__main__': | 1966 if __name__ == '__main__': |
1964 git_cl.logging.basicConfig( | 1967 git_cl.logging.basicConfig( |
1965 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 1968 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
1966 unittest.main() | 1969 unittest.main() |
OLD | NEW |