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

Side by Side Diff: tests/gcl_unittest.py

Issue 2301003: Massive overhaul for gcl help (Closed)
Patch Set: Created 10 years, 7 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 | « gcl.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/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2010 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 # Fixes include path. 8 # Fixes include path.
9 from super_mox import mox, SuperMoxTestBase 9 from super_mox import mox, SuperMoxTestBase
10 10
(...skipping 18 matching lines...) Expand all
29 class GclUnittest(GclTestsBase): 29 class GclUnittest(GclTestsBase):
30 """General gcl.py tests.""" 30 """General gcl.py tests."""
31 def testMembersChanged(self): 31 def testMembersChanged(self):
32 self.mox.ReplayAll() 32 self.mox.ReplayAll()
33 members = [ 33 members = [
34 'CODEREVIEW_SETTINGS', 'CODEREVIEW_SETTINGS_FILE', 34 'CODEREVIEW_SETTINGS', 'CODEREVIEW_SETTINGS_FILE',
35 'CMDchange', 'CMDchanges', 'CMDcommit', 'CMDdelete', 'CMDdeleteempties', 35 'CMDchange', 'CMDchanges', 'CMDcommit', 'CMDdelete', 'CMDdeleteempties',
36 'CMDdescription', 'CMDdiff', 'CMDhelp', 'CMDlint', 'CMDnothave', 36 'CMDdescription', 'CMDdiff', 'CMDhelp', 'CMDlint', 'CMDnothave',
37 'CMDopened', 'CMDpassthru', 'CMDpresubmit', 'CMDrename', 'CMDsettings', 37 'CMDopened', 'CMDpassthru', 'CMDpresubmit', 'CMDrename', 'CMDsettings',
38 'CMDstatus', 'CMDtry', 'CMDupload', 38 'CMDstatus', 'CMDtry', 'CMDupload',
39 'ChangeInfo', 'DEFAULT_LINT_IGNORE_REGEX', 39 'ChangeInfo', 'Command', 'DEFAULT_LINT_IGNORE_REGEX',
40 'DEFAULT_LINT_REGEX', 'CheckHomeForFile', 40 'DEFAULT_LINT_REGEX', 'CheckHomeForFile', 'DoPresubmitChecks',
41 'DoPresubmitChecks', 'ErrorExit', 'FILES_CACHE', 'FilterFlag', 41 'ErrorExit', 'FILES_CACHE', 'FilterFlag', 'GenUsage',
42 'GenerateChangeName', 'GenerateDiff', 'GetCLs', 'GetCacheDir', 42 'GenerateChangeName', 'GenerateDiff', 'GetCLs', 'GetCacheDir',
43 'GetCachedFile', 'GetChangelistInfoFile', 'GetChangesDir', 43 'GetCachedFile', 'GetChangelistInfoFile', 'GetChangesDir',
44 'GetCodeReviewSetting', 'GetEditor', 'GetFilesNotInCL', 'GetInfoDir', 44 'GetCodeReviewSetting', 'GetEditor', 'GetFilesNotInCL', 'GetInfoDir',
45 'GetIssueDescription', 'GetModifiedFiles', 'GetRepositoryRoot', 45 'GetIssueDescription', 'GetModifiedFiles', 'GetRepositoryRoot',
46 'ListFiles', 46 'ListFiles',
47 'LoadChangelistInfoForMultiple', 'MISSING_TEST_MSG', 47 'LoadChangelistInfoForMultiple', 'MISSING_TEST_MSG',
48 'OptionallyDoPresubmitChecks', 'REPOSITORY_ROOT', 48 'OptionallyDoPresubmitChecks', 'REPOSITORY_ROOT',
49 'RunShell', 'RunShellWithReturnCode', 'SVN', 49 'RunShell', 'RunShellWithReturnCode', 'SVN',
50 'SendToRietveld', 'TryChange', 'UnknownFiles', 'Warn', 50 'SendToRietveld', 'TryChange', 'UnknownFiles', 'Warn',
51 'breakpad', 'gclient_utils', 'getpass', 'main', 'need_change', 'os', 51 'attrs', 'breakpad', 'defer_attributes', 'gclient_utils', 'getpass',
52 'main', 'need_change', 'need_change_and_args', 'no_args', 'os',
52 'random', 're', 'shutil', 'string', 'subprocess', 'sys', 'tempfile', 53 'random', 're', 'shutil', 'string', 'subprocess', 'sys', 'tempfile',
53 'time', 'upload', 'urllib2', 54 'time', 'upload', 'urllib2',
54 ] 55 ]
55 # If this test fails, you should add the relevant test. 56 # If this test fails, you should add the relevant test.
56 self.compareMembers(gcl, members) 57 self.compareMembers(gcl, members)
57 58
58 def testIsSVNMoved(self): 59 def testIsSVNMoved(self):
59 # TODO(maruel): TEST ME 60 # TODO(maruel): TEST ME
60 pass 61 pass
61 62
(...skipping 16 matching lines...) Expand all
78 self.assertRaises(gcl.gclient_utils.Error, gcl.GetRepositoryRoot) 79 self.assertRaises(gcl.gclient_utils.Error, gcl.GetRepositoryRoot)
79 80
80 def testGetRepositoryRootGood(self): 81 def testGetRepositoryRootGood(self):
81 root_path = gcl.os.path.join('bleh', 'prout', 'pouet') 82 root_path = gcl.os.path.join('bleh', 'prout', 'pouet')
82 gcl.os.getcwd().AndReturn(root_path) 83 gcl.os.getcwd().AndReturn(root_path)
83 gcl.SVN.GetCheckoutRoot(root_path).AndReturn(root_path + '.~') 84 gcl.SVN.GetCheckoutRoot(root_path).AndReturn(root_path + '.~')
84 self.mox.ReplayAll() 85 self.mox.ReplayAll()
85 self.assertEquals(gcl.GetRepositoryRoot(), root_path + '.~') 86 self.assertEquals(gcl.GetRepositoryRoot(), root_path + '.~')
86 87
87 def testHelp(self): 88 def testHelp(self):
88 gcl.sys.stdout.write(mox.StrContains('GCL is a wrapper for Subversion')) 89 gcl.sys.stdout.write = lambda x: None
89 gcl.sys.stdout.write('\n')
90 self.mox.ReplayAll() 90 self.mox.ReplayAll()
91 gcl.CMDhelp([]) 91 gcl.CMDhelp([])
92 92
93 93
94 class ChangeInfoUnittest(GclTestsBase): 94 class ChangeInfoUnittest(GclTestsBase):
95 def setUp(self): 95 def setUp(self):
96 GclTestsBase.setUp(self) 96 GclTestsBase.setUp(self)
97 self.mox.StubOutWithMock(gcl, 'GetChangelistInfoFile') 97 self.mox.StubOutWithMock(gcl, 'GetChangelistInfoFile')
98 self.mox.StubOutWithMock(gcl, 'GetRepositoryRoot') 98 self.mox.StubOutWithMock(gcl, 'GetRepositoryRoot')
99 99
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 self.mox.ReplayAll() 312 self.mox.ReplayAll()
313 313
314 gcl.CMDupload(['naame', '--no_watchlists']) 314 gcl.CMDupload(['naame', '--no_watchlists'])
315 self.assertEquals(change_info.issue, 1) 315 self.assertEquals(change_info.issue, 1)
316 self.assertEquals(change_info.patchset, 2) 316 self.assertEquals(change_info.patchset, 2)
317 317
318 318
319 if __name__ == '__main__': 319 if __name__ == '__main__':
320 import unittest 320 import unittest
321 unittest.main() 321 unittest.main()
OLDNEW
« 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