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

Side by Side Diff: tests/git_cl_test.py

Issue 2280563003: Fix Gerrit git cl land and add test. (Closed)
Patch Set: Fix code and finish test. Created 4 years, 3 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 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after
1887 self.calls += [ 1887 self.calls += [
1888 ((['exists', '/abs/git_repo_root/.git/hooks/commit-msg'],), True), 1888 ((['exists', '/abs/git_repo_root/.git/hooks/commit-msg'],), True),
1889 ((['FileRead', '/abs/git_repo_root/.git/hooks/commit-msg'],), 1889 ((['FileRead', '/abs/git_repo_root/.git/hooks/commit-msg'],),
1890 '...\n# From Gerrit Code Review\n...\nadd_ChangeId()\n'), 1890 '...\n# From Gerrit Code Review\n...\nadd_ChangeId()\n'),
1891 (('Do you want to remove it now? [Yes/No]',), 'Yes'), 1891 (('Do you want to remove it now? [Yes/No]',), 'Yes'),
1892 ((['rm_file_or_tree', '/abs/git_repo_root/.git/hooks/commit-msg'],), 1892 ((['rm_file_or_tree', '/abs/git_repo_root/.git/hooks/commit-msg'],),
1893 ''), 1893 ''),
1894 ] 1894 ]
1895 cl._codereview_impl._GerritCommitMsgHookCheck(offer_removal=True) 1895 cl._codereview_impl._GerritCommitMsgHookCheck(offer_removal=True)
1896 1896
1897 def test_GerritCmdLand(self):
1898 self.calls += [
1899 ((['git', 'symbolic-ref', 'HEAD'],), 'feature'),
1900 ((['git', 'config', 'branch.feature.gerritsquashhash'],),
1901 'deadbeaf'),
1902 ((['git', 'diff', 'deadbeaf'],), ''), # No diff.
1903 ((['git', 'config', 'branch.feature.gerritserver'],),
1904 'chromium-review.googlesource.com'),
1905 ]
1906 cl = git_cl.Changelist(issue=123, codereview='gerrit')
1907 cl._codereview_impl._GetChangeDetail = lambda _: {
1908 'labels': {},
1909 'current_revision': 'deadbeaf',
1910 }
1911 cl._codereview_impl.SubmitIssue = lambda wait_for_merge: None
1912 self.assertEqual(0, cl.CMDLand(force=True, bypass_hooks=True, verbose=True))
1913
1897 1914
1898 if __name__ == '__main__': 1915 if __name__ == '__main__':
1899 git_cl.logging.basicConfig( 1916 git_cl.logging.basicConfig(
1900 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) 1917 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR)
1901 unittest.main() 1918 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