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

Side by Side Diff: tests/git_cl_test.py

Issue 2032433003: git cl issue 0 should really clear issue. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: fix Created 4 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
« no previous file with comments | « git_cl.py ('k') | no next file » | 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 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 1435 matching lines...) Expand 10 before | Expand all | Expand 10 after
1446 def test_description_set_stdin(self): 1446 def test_description_set_stdin(self):
1447 out = StringIO.StringIO() 1447 out = StringIO.StringIO()
1448 self.mock(git_cl.sys, 'stdout', out) 1448 self.mock(git_cl.sys, 'stdout', out)
1449 1449
1450 self.mock(git_cl, 'Changelist', ChangelistMock) 1450 self.mock(git_cl, 'Changelist', ChangelistMock)
1451 self.mock(git_cl.sys, 'stdin', StringIO.StringIO('hi \r\n\t there\n\nman')) 1451 self.mock(git_cl.sys, 'stdin', StringIO.StringIO('hi \r\n\t there\n\nman'))
1452 1452
1453 self.assertEqual(0, git_cl.main(['description', '-n', '-'])) 1453 self.assertEqual(0, git_cl.main(['description', '-n', '-']))
1454 self.assertEqual('hi\n\t there\n\nman', ChangelistMock.desc) 1454 self.assertEqual('hi\n\t there\n\nman', ChangelistMock.desc)
1455 1455
1456 def test_cmd_issue_erase_existing(self):
1457 out = StringIO.StringIO()
1458 self.mock(git_cl.sys, 'stdout', out)
1459 self.calls = [
1460 ((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
1461 ((['git', 'config', 'branch.feature.rietveldissue'],), ''),
1462 ((['git', 'config', 'branch.feature.gerritissue'],), '123'),
1463 ((['git', 'config', '--unset', 'branch.feature.gerritissue'],), ''),
1464 ((['git', 'config', '--unset', 'branch.feature.gerritpatchset'],), ''),
1465 # Let this command raise exception (retcode=1) - it should be ignored.
1466 ((['git', 'config', '--unset', 'branch.feature.last-upload-hash'],),
1467 '', subprocess2.CalledProcessError(1, '', '', '', '')),
1468 ((['git', 'config', '--unset', 'branch.feature.gerritserver'],), ''),
1469 ((['git', 'config', '--unset', 'branch.feature.gerritsquashhash'],),
1470 ''),
1471 ]
1472 self.assertEqual(0, git_cl.main(['issue', '0']))
1473
1456 1474
1457 if __name__ == '__main__': 1475 if __name__ == '__main__':
1458 git_cl.logging.basicConfig( 1476 git_cl.logging.basicConfig(
1459 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) 1477 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR)
1460 unittest.main() 1478 unittest.main()
OLDNEW
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698