| 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
|
|
|