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 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 """Tests git cl checkout <issue>.""" | 1173 """Tests git cl checkout <issue>.""" |
1174 self.calls = self._checkout_calls() | 1174 self.calls = self._checkout_calls() |
1175 self.calls += [((['git', 'checkout', 'some-fix'], ), '')] | 1175 self.calls += [((['git', 'checkout', 'some-fix'], ), '')] |
1176 self.assertEqual(0, git_cl.main(['checkout', '2222222222'])) | 1176 self.assertEqual(0, git_cl.main(['checkout', '2222222222'])) |
1177 | 1177 |
1178 def test_checkout_not_found(self): | 1178 def test_checkout_not_found(self): |
1179 """Tests git cl checkout <issue>.""" | 1179 """Tests git cl checkout <issue>.""" |
1180 self.calls = self._checkout_calls() | 1180 self.calls = self._checkout_calls() |
1181 self.assertEqual(1, git_cl.main(['checkout', '99999'])) | 1181 self.assertEqual(1, git_cl.main(['checkout', '99999'])) |
1182 | 1182 |
| 1183 def test_checkout_no_branch_issues(self): |
| 1184 """Tests git cl checkout <issue>.""" |
| 1185 self.calls = [ |
| 1186 ((['git', 'config', '--local', '--get-regexp', |
| 1187 'branch\\..*\\.rietveldissue'], ), '', |
| 1188 subprocess2.CalledProcessError(1, '', '', '', '')), |
| 1189 ((['git', 'config', '--local', '--get-regexp', |
| 1190 'branch\\..*\\.gerritissue'], ), '', |
| 1191 subprocess2.CalledProcessError(1, '', '', '', '')), |
| 1192 |
| 1193 ] |
| 1194 self.assertEqual(1, git_cl.main(['checkout', '99999'])) |
| 1195 |
1183 | 1196 |
1184 if __name__ == '__main__': | 1197 if __name__ == '__main__': |
1185 git_cl.logging.basicConfig( | 1198 git_cl.logging.basicConfig( |
1186 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 1199 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
1187 unittest.main() | 1200 unittest.main() |
OLD | NEW |