| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 gcl.py.""" | 6 """Unit tests for gcl.py.""" |
| 7 | 7 |
| 8 # Fixes include path. | 8 # Fixes include path. |
| 9 from super_mox import mox, SuperMoxTestBase | 9 from super_mox import mox, SuperMoxTestBase |
| 10 | 10 |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 gcl.sys.stdout.write("\n") | 318 gcl.sys.stdout.write("\n") |
| 319 gcl.GetRepositoryRoot().AndReturn(self.fake_root_dir) | 319 gcl.GetRepositoryRoot().AndReturn(self.fake_root_dir) |
| 320 gcl.ChangeInfo.Load('naame', self.fake_root_dir, True, True | 320 gcl.ChangeInfo.Load('naame', self.fake_root_dir, True, True |
| 321 ).AndReturn(change_info) | 321 ).AndReturn(change_info) |
| 322 self.mox.ReplayAll() | 322 self.mox.ReplayAll() |
| 323 | 323 |
| 324 gcl.CMDupload(['naame', '--no_watchlists']) | 324 gcl.CMDupload(['naame', '--no_watchlists']) |
| 325 self.assertEquals(change_info.issue, 1) | 325 self.assertEquals(change_info.issue, 1) |
| 326 self.assertEquals(change_info.patchset, 2) | 326 self.assertEquals(change_info.patchset, 2) |
| 327 | 327 |
| 328 def testNoServer(self): |
| 329 self.mox.StubOutWithMock(gcl.sys, 'stderr') |
| 330 gcl.sys.stderr.write( |
| 331 'Don\'t use the -s flag, fix codereview.settings instead') |
| 332 gcl.sys.stderr.write('\n') |
| 333 gcl.GetRepositoryRoot().AndReturn(self.fake_root_dir) |
| 334 gcl.ChangeInfo.Load('naame', self.fake_root_dir, True, True |
| 335 ).AndReturn(1) |
| 336 self.mox.ReplayAll() |
| 337 |
| 338 try: |
| 339 gcl.CMDupload(['naame', '-s', 'foo']) |
| 340 self.fail() |
| 341 except SystemExit: |
| 342 pass |
| 343 |
| 328 | 344 |
| 329 if __name__ == '__main__': | 345 if __name__ == '__main__': |
| 330 import unittest | 346 import unittest |
| 331 unittest.main() | 347 unittest.main() |
| OLD | NEW |