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

Side by Side Diff: tests/gcl_unittest.py

Issue 12276007: Add patchset number on manual commit comment. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 7 years, 10 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
« git_cl.py ('K') | « 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 gcl.py.""" 6 """Unit tests for gcl.py."""
7 7
8 # pylint: disable=E1103,E1101,E1120 8 # pylint: disable=E1103,E1101,E1120
9 9
10 import os 10 import os
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 change_info = self.mox.CreateMock(gcl.ChangeInfo) 44 change_info = self.mox.CreateMock(gcl.ChangeInfo)
45 change_info.name = 'naame' 45 change_info.name = 'naame'
46 change_info.issue = 1 46 change_info.issue = 1
47 change_info.patchset = 0 47 change_info.patchset = 0
48 change_info.description = 'deescription' 48 change_info.description = 'deescription'
49 change_info.files = files 49 change_info.files = files
50 change_info.GetFiles = lambda : change_info.files 50 change_info.GetFiles = lambda : change_info.files
51 change_info.GetIssueDescription = lambda : change_info.description 51 change_info.GetIssueDescription = lambda : change_info.description
52 change_info.GetFileNames = lambda : [f[1] for f in change_info.files] 52 change_info.GetFileNames = lambda : [f[1] for f in change_info.files]
53 change_info.GetLocalRoot = lambda : 'proout' 53 change_info.GetLocalRoot = lambda : 'proout'
54 change_info.GetIssueProperties = lambda : { 'patchsets': [1337] }
54 change_info.patch = None 55 change_info.patch = None
55 change_info.rietveld = 'https://my_server' 56 change_info.rietveld = 'https://my_server'
56 change_info.reviewers = None 57 change_info.reviewers = None
57 change_info._closed = False 58 change_info._closed = False
58 change_info._deleted = False 59 change_info._deleted = False
59 change_info._comments_added = [] 60 change_info._comments_added = []
60 61
61 def AddComment(comment): 62 def AddComment(comment):
62 # pylint: disable=W0212 63 # pylint: disable=W0212
63 change_info._comments_added.append(comment) 64 change_info._comments_added.append(comment)
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 class ChangeInfoUnittest(GclTestsBase): 181 class ChangeInfoUnittest(GclTestsBase):
181 def setUp(self): 182 def setUp(self):
182 GclTestsBase.setUp(self) 183 GclTestsBase.setUp(self)
183 self.mox.StubOutWithMock(gcl, 'GetChangelistInfoFile') 184 self.mox.StubOutWithMock(gcl, 'GetChangelistInfoFile')
184 self.mox.StubOutWithMock(gcl, 'GetRepositoryRoot') 185 self.mox.StubOutWithMock(gcl, 'GetRepositoryRoot')
185 186
186 def testChangeInfoMembers(self): 187 def testChangeInfoMembers(self):
187 self.mox.ReplayAll() 188 self.mox.ReplayAll()
188 members = [ 189 members = [
189 'AddComment', 'CloseIssue', 'Delete', 'Exists', 'GetFiles', 190 'AddComment', 'CloseIssue', 'Delete', 'Exists', 'GetFiles',
190 'GetFileNames', 'GetLocalRoot', 'GetIssueDescription', 'Load', 191 'GetFileNames', 'GetIssueProperties', 'GetLocalRoot',
192 'GetIssueDescription', 'Load',
191 'MissingTests', 'NeedsUpload', 'PrimeLint', 'RpcServer', 'Save', 193 'MissingTests', 'NeedsUpload', 'PrimeLint', 'RpcServer', 'Save',
192 'SendToRietveld', 194 'SendToRietveld',
193 'SEPARATOR', 195 'SEPARATOR',
194 'UpdateRietveldDescription', 196 'UpdateRietveldDescription',
195 'description', 'issue', 'name', 197 'description', 'issue', 'name',
196 'needs_upload', 'patch', 'patchset', 'reviewers', 'rietveld', 198 'needs_upload', 'patch', 'patchset', 'reviewers', 'rietveld',
197 ] 199 ]
198 # If this test fails, you should add the relevant test. 200 # If this test fails, you should add the relevant test.
199 self.compareMembers( 201 self.compareMembers(
200 gcl.ChangeInfo('', 0, 0, '', None, self.fake_root_dir, 'foo', False), 202 gcl.ChangeInfo('', 0, 0, '', None, self.fake_root_dir, 'foo', False),
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 590
589 retval = gcl.CMDcommit(['naame']) 591 retval = gcl.CMDcommit(['naame'])
590 self.assertEquals(retval, 0) 592 self.assertEquals(retval, 0)
591 self.assertEquals(change_info.description, 593 self.assertEquals(change_info.description,
592 'deescription\n\nCommitted: http://view/12345') 594 'deescription\n\nCommitted: http://view/12345')
593 # pylint: disable=W0212 595 # pylint: disable=W0212
594 self.assertTrue(change_info._deleted) 596 self.assertTrue(change_info._deleted)
595 self.assertTrue(change_info._closed) 597 self.assertTrue(change_info._closed)
596 self.assertEqual( 598 self.assertEqual(
597 change_info._comments_added, 599 change_info._comments_added,
598 ["Committed manually as r12345 (presubmit successful)."]) 600 ["Committed patch #1 manually as r12345 (presubmit successful)."])
599 601
600 602
601 if __name__ == '__main__': 603 if __name__ == '__main__':
602 import unittest 604 import unittest
603 unittest.main() 605 unittest.main()
OLDNEW
« git_cl.py ('K') | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698