Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: tests/gcl_unittest.py

Issue 298703003: Upload project option (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « git_cl.py ('k') | tests/git_cl_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 gcl.py.""" 6 """Unit tests for gcl.py."""
7 7
8 # pylint: disable=E1103,E1101,E1120 8 # pylint: disable=E1103,E1101,E1120
9 9
10 import os 10 import os
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 False) 360 False)
361 self.mox.StubOutWithMock(change_info, 'Save') 361 self.mox.StubOutWithMock(change_info, 'Save')
362 change_info.Save() 362 change_info.Save()
363 output = presubmit_support.PresubmitOutput() 363 output = presubmit_support.PresubmitOutput()
364 gcl.DoPresubmitChecks(change_info, False, True).AndReturn(output) 364 gcl.DoPresubmitChecks(change_info, False, True).AndReturn(output)
365 gcl.tempfile.mkstemp(text=True).AndReturn((42, 'descfile')) 365 gcl.tempfile.mkstemp(text=True).AndReturn((42, 'descfile'))
366 gcl.os.write(42, change_info.description) 366 gcl.os.write(42, change_info.description)
367 gcl.os.close(42) 367 gcl.os.close(42)
368 gcl.GetCodeReviewSetting('CC_LIST') 368 gcl.GetCodeReviewSetting('CC_LIST')
369 gcl.GetCodeReviewSetting('PRIVATE') 369 gcl.GetCodeReviewSetting('PRIVATE')
370 gcl.GetCodeReviewSetting('PROJECT')
370 gcl.os.getcwd().AndReturn('somewhere') 371 gcl.os.getcwd().AndReturn('somewhere')
371 gcl.os.chdir(change_info.GetLocalRoot()) 372 gcl.os.chdir(change_info.GetLocalRoot())
372 gcl.GenerateDiff(change_info.GetFileNames()) 373 gcl.GenerateDiff(change_info.GetFileNames())
373 gcl.upload.RealMain( 374 gcl.upload.RealMain(
374 [ 'upload.py', '-y', '--server=https://my_server', '--server=a', 375 [ 'upload.py', '-y', '--server=https://my_server', '--server=a',
375 '--file=descfile'], 376 '--file=descfile'],
376 change_info.patch).AndReturn(("1", "2")) 377 change_info.patch).AndReturn(("1", "2"))
377 gcl.os.remove('descfile') 378 gcl.os.remove('descfile')
378 change_info.SendToRietveld("/lint/issue%s_%s" % ('1', '2'), timeout=10) 379 change_info.SendToRietveld("/lint/issue%s_%s" % ('1', '2'), timeout=10)
379 gcl.os.chdir('somewhere') 380 gcl.os.chdir('somewhere')
(...skipping 22 matching lines...) Expand all
402 False) 403 False)
403 self.mox.StubOutWithMock(change_info, 'Save') 404 self.mox.StubOutWithMock(change_info, 'Save')
404 change_info.Save() 405 change_info.Save()
405 output = presubmit_support.PresubmitOutput() 406 output = presubmit_support.PresubmitOutput()
406 gcl.DoPresubmitChecks(change_info, False, True).AndReturn(output) 407 gcl.DoPresubmitChecks(change_info, False, True).AndReturn(output)
407 gcl.tempfile.mkstemp(text=True).AndReturn((42, 'descfile')) 408 gcl.tempfile.mkstemp(text=True).AndReturn((42, 'descfile'))
408 gcl.os.write(42, change_info.description) 409 gcl.os.write(42, change_info.description)
409 gcl.os.close(42) 410 gcl.os.close(42)
410 gcl.GetCodeReviewSetting('CC_LIST') 411 gcl.GetCodeReviewSetting('CC_LIST')
411 gcl.GetCodeReviewSetting('PRIVATE') 412 gcl.GetCodeReviewSetting('PRIVATE')
413 gcl.GetCodeReviewSetting('PROJECT')
412 gcl.os.getcwd().AndReturn('somewhere') 414 gcl.os.getcwd().AndReturn('somewhere')
413 gcl.os.chdir(change_info.GetLocalRoot()) 415 gcl.os.chdir(change_info.GetLocalRoot())
414 gcl.GenerateDiff(change_info.GetFileNames()) 416 gcl.GenerateDiff(change_info.GetFileNames())
415 gcl.upload.RealMain( 417 gcl.upload.RealMain(
416 ['upload.py', '-y', '--server=https://my_server', "--file=descfile" ], 418 ['upload.py', '-y', '--server=https://my_server', "--file=descfile" ],
417 change_info.patch).AndReturn(("1", "2")) 419 change_info.patch).AndReturn(("1", "2"))
418 gcl.os.remove('descfile') 420 gcl.os.remove('descfile')
419 change_info.SendToRietveld("/lint/issue%s_%s" % ('1', '2'), timeout=10) 421 change_info.SendToRietveld("/lint/issue%s_%s" % ('1', '2'), timeout=10)
420 gcl.os.chdir('somewhere') 422 gcl.os.chdir('somewhere')
421 gcl.sys.stdout.write("*** Upload does not submit a try; use gcl try to" 423 gcl.sys.stdout.write("*** Upload does not submit a try; use gcl try to"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 self.assertTrue(change_info._deleted) 612 self.assertTrue(change_info._deleted)
611 self.assertTrue(change_info._closed) 613 self.assertTrue(change_info._closed)
612 self.assertEqual( 614 self.assertEqual(
613 change_info._comments_added, 615 change_info._comments_added,
614 ["Committed patchset #1 manually as r12345 (presubmit successful)."]) 616 ["Committed patchset #1 manually as r12345 (presubmit successful)."])
615 617
616 618
617 if __name__ == '__main__': 619 if __name__ == '__main__':
618 import unittest 620 import unittest
619 unittest.main() 621 unittest.main()
OLDNEW
« no previous file with comments | « git_cl.py ('k') | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698