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

Side by Side Diff: tests/gcl_unittest.py

Issue 8038028: Use universal EOL conversion when calling the text editor in gcl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 9 years, 2 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 | « presubmit_support.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) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 is too confused. 8 # pylint is too confused.
9 # pylint: disable=E1101,E1103,E1120,W0212,W0403 9 # pylint: disable=E1101,E1103,E1120,W0212,W0403
10 10
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 self.assertEquals(o.patch, None) 209 self.assertEquals(o.patch, None)
210 self.assertEquals(o.GetFileNames(), ['foo', 'bar']) 210 self.assertEquals(o.GetFileNames(), ['foo', 'bar'])
211 self.assertEquals(o.GetFiles(), files) 211 self.assertEquals(o.GetFiles(), files)
212 self.assertEquals(o.GetLocalRoot(), self.fake_root_dir) 212 self.assertEquals(o.GetLocalRoot(), self.fake_root_dir)
213 213
214 def testLoadWithIssue(self): 214 def testLoadWithIssue(self):
215 self.mox.StubOutWithMock(gcl, 'GetCodeReviewSetting') 215 self.mox.StubOutWithMock(gcl, 'GetCodeReviewSetting')
216 description = ["This is some description.", "force an extra separator."] 216 description = ["This is some description.", "force an extra separator."]
217 gcl.GetChangelistInfoFile('bleh').AndReturn('bleeeh') 217 gcl.GetChangelistInfoFile('bleh').AndReturn('bleeeh')
218 gcl.os.path.exists('bleeeh').AndReturn(True) 218 gcl.os.path.exists('bleeeh').AndReturn(True)
219 gcl.gclient_utils.FileRead('bleeeh', 'r').AndReturn( 219 gcl.gclient_utils.FileRead('bleeeh').AndReturn(
220 gcl.ChangeInfo._SEPARATOR.join(["42, 53", "G b.cc"] + description)) 220 gcl.ChangeInfo._SEPARATOR.join(["42, 53", "G b.cc"] + description))
221 gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('foo') 221 gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('foo')
222 # Does an upgrade. 222 # Does an upgrade.
223 gcl.GetChangelistInfoFile('bleh').AndReturn('bleeeh') 223 gcl.GetChangelistInfoFile('bleh').AndReturn('bleeeh')
224 gcl.gclient_utils.FileWrite('bleeeh', mox.IgnoreArg()) 224 gcl.gclient_utils.FileWrite('bleeeh', mox.IgnoreArg())
225 self.mox.ReplayAll() 225 self.mox.ReplayAll()
226 226
227 change_info = gcl.ChangeInfo.Load('bleh', self.fake_root_dir, True, False) 227 change_info = gcl.ChangeInfo.Load('bleh', self.fake_root_dir, True, False)
228 self.assertEquals(change_info.name, 'bleh') 228 self.assertEquals(change_info.name, 'bleh')
229 self.assertEquals(change_info.issue, 42) 229 self.assertEquals(change_info.issue, 42)
230 self.assertEquals(change_info.patchset, 53) 230 self.assertEquals(change_info.patchset, 53)
231 self.assertEquals(change_info.description, 231 self.assertEquals(change_info.description,
232 gcl.ChangeInfo._SEPARATOR.join(description)) 232 gcl.ChangeInfo._SEPARATOR.join(description))
233 self.assertEquals(change_info.GetFiles(), [('G ', 'b.cc')]) 233 self.assertEquals(change_info.GetFiles(), [('G ', 'b.cc')])
234 234
235 def testLoadEmpty(self): 235 def testLoadEmpty(self):
236 self.mox.StubOutWithMock(gcl, 'GetCodeReviewSetting') 236 self.mox.StubOutWithMock(gcl, 'GetCodeReviewSetting')
237 gcl.GetChangelistInfoFile('bleh').AndReturn('bleeeh') 237 gcl.GetChangelistInfoFile('bleh').AndReturn('bleeeh')
238 gcl.os.path.exists('bleeeh').AndReturn(True) 238 gcl.os.path.exists('bleeeh').AndReturn(True)
239 gcl.gclient_utils.FileRead('bleeeh', 'r').AndReturn( 239 gcl.gclient_utils.FileRead('bleeeh').AndReturn(
240 gcl.ChangeInfo._SEPARATOR.join(["", "", ""])) 240 gcl.ChangeInfo._SEPARATOR.join(["", "", ""]))
241 gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('foo') 241 gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('foo')
242 # Does an upgrade. 242 # Does an upgrade.
243 gcl.GetChangelistInfoFile('bleh').AndReturn('bleeeh') 243 gcl.GetChangelistInfoFile('bleh').AndReturn('bleeeh')
244 gcl.gclient_utils.FileWrite('bleeeh', mox.IgnoreArg()) 244 gcl.gclient_utils.FileWrite('bleeeh', mox.IgnoreArg())
245 self.mox.ReplayAll() 245 self.mox.ReplayAll()
246 246
247 change_info = gcl.ChangeInfo.Load('bleh', self.fake_root_dir, True, False) 247 change_info = gcl.ChangeInfo.Load('bleh', self.fake_root_dir, True, False)
248 self.assertEquals(change_info.name, 'bleh') 248 self.assertEquals(change_info.name, 'bleh')
249 self.assertEquals(change_info.issue, 0) 249 self.assertEquals(change_info.issue, 0)
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 self.assertEquals(retval, 0) 581 self.assertEquals(retval, 0)
582 self.assertEquals(change_info.description, 582 self.assertEquals(change_info.description,
583 'deescription\n\nCommitted: http://view/12345') 583 'deescription\n\nCommitted: http://view/12345')
584 self.assertTrue(change_info._deleted) 584 self.assertTrue(change_info._deleted)
585 self.assertTrue(change_info._closed) 585 self.assertTrue(change_info._closed)
586 586
587 587
588 if __name__ == '__main__': 588 if __name__ == '__main__':
589 import unittest 589 import unittest
590 unittest.main() 590 unittest.main()
OLDNEW
« no previous file with comments | « presubmit_support.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698