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

Unified Diff: tests/gcl_unittest.py

Issue 434061: gcl: add a new flag '-c' that stands for 'contributor'.... (Closed) Base URL: http://src.chromium.org/svn/trunk/tools/depot_tools/
Patch Set: following marc comments Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gcl.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/gcl_unittest.py
===================================================================
--- tests/gcl_unittest.py (revision 33161)
+++ tests/gcl_unittest.py (working copy)
@@ -137,6 +137,41 @@
# TODO(maruel): TEST ME
pass
+ def testCommitWithContributor(self):
+ self.mox.StubOutWithMock(gcl, 'OptionallyDoPresubmitChecks')
+ self.mox.StubOutWithMock(gcl, 'GetIssueDescription')
+ self.mox.StubOutWithMock(gcl, 'GetCodeReviewSetting')
+ self.mox.StubOutWithMock(gcl.ChangeInfo, 'GetLocalRoot')
+ self.mox.StubOutWithMock(gcl.ChangeInfo, 'Delete')
+
+ root_dir1 = self.Dir()
+ root_dir2 = self.Dir()
+
+ change_info = gcl.ChangeInfo('test-commit-contributor', 0, 0, 'Testing',
+ [('A', 'aa'), ('B', 'bb')], self.fake_root_dir)
+
+ expected_text = """Testing\nPatch from john"""
+
+ # Call sequence
+ gcl.DoPresubmitChecks(change_info, True, True).AndReturn(True)
+ file_handle = 42
+ file_name = "descfile"
+ gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('my_server')
+ gcl.tempfile.mkstemp(text=True).AndReturn((file_handle, file_name))
+ gcl.os.write(file_handle, expected_text)
+ gcl.os.close(file_handle)
+ gcl.os.getcwd().AndReturn(root_dir1)
+ change_info.GetLocalRoot().AndReturn(root_dir2)
+ gcl.os.chdir(root_dir2)
+ gcl.os.remove(file_name)
+ gcl.RunShell(['svn', 'commit', '--file=..',
+ '--targets=..']).AndReturn("Committed revision")
+
+ args = ['-c', 'john']
+ # Now time to actually run the test:
+ self.mox.ReplayAll()
+ gcl.Commit(change_info, args)
+
def testChange(self):
# TODO(maruel): TEST ME
pass
« no previous file with comments | « gcl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698