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

Side by Side Diff: tests/gcl_unittest.py

Issue 12047089: Make gcl commit/git cl dcommit append a commit notification to rietveld. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Pull AddComment from git_cl.py 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
« no previous file with comments | « 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.patch = None 54 change_info.patch = None
55 change_info.rietveld = 'https://my_server' 55 change_info.rietveld = 'https://my_server'
56 change_info.reviewers = None 56 change_info.reviewers = None
57 change_info._closed = False 57 change_info._closed = False
58 change_info._deleted = False 58 change_info._deleted = False
59 change_info._comments_added = []
60
61 def AddComment(comment):
62 # pylint: disable=W0212
63 change_info._comments_added.append(comment)
64 change_info.AddComment = AddComment
59 65
60 def Delete(): 66 def Delete():
61 change_info._deleted = True 67 change_info._deleted = True
62 change_info.Delete = Delete 68 change_info.Delete = Delete
63 69
64 def CloseIssue(): 70 def CloseIssue():
65 change_info._closed = True 71 change_info._closed = True
66 change_info.CloseIssue = CloseIssue 72 change_info.CloseIssue = CloseIssue
67 73
68 return change_info 74 return change_info
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 179
174 class ChangeInfoUnittest(GclTestsBase): 180 class ChangeInfoUnittest(GclTestsBase):
175 def setUp(self): 181 def setUp(self):
176 GclTestsBase.setUp(self) 182 GclTestsBase.setUp(self)
177 self.mox.StubOutWithMock(gcl, 'GetChangelistInfoFile') 183 self.mox.StubOutWithMock(gcl, 'GetChangelistInfoFile')
178 self.mox.StubOutWithMock(gcl, 'GetRepositoryRoot') 184 self.mox.StubOutWithMock(gcl, 'GetRepositoryRoot')
179 185
180 def testChangeInfoMembers(self): 186 def testChangeInfoMembers(self):
181 self.mox.ReplayAll() 187 self.mox.ReplayAll()
182 members = [ 188 members = [
183 'CloseIssue', 'Delete', 'Exists', 'GetFiles', 'GetFileNames', 189 'AddComment', 'CloseIssue', 'Delete', 'Exists', 'GetFiles',
184 'GetLocalRoot', 'GetIssueDescription', 'Load', 'MissingTests', 190 'GetFileNames', 'GetLocalRoot', 'GetIssueDescription', 'Load',
185 'NeedsUpload', 'PrimeLint', 'RpcServer', 'Save', 'SendToRietveld', 191 'MissingTests', 'NeedsUpload', 'PrimeLint', 'RpcServer', 'Save',
192 'SendToRietveld',
186 'SEPARATOR', 193 'SEPARATOR',
187 'UpdateRietveldDescription', 194 'UpdateRietveldDescription',
188 'description', 'issue', 'name', 195 'description', 'issue', 'name',
189 'needs_upload', 'patch', 'patchset', 'reviewers', 'rietveld', 196 'needs_upload', 'patch', 'patchset', 'reviewers', 'rietveld',
190 ] 197 ]
191 # If this test fails, you should add the relevant test. 198 # If this test fails, you should add the relevant test.
192 self.compareMembers( 199 self.compareMembers(
193 gcl.ChangeInfo('', 0, 0, '', None, self.fake_root_dir, 'foo', False), 200 gcl.ChangeInfo('', 0, 0, '', None, self.fake_root_dir, 'foo', False),
194 members) 201 members)
195 202
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 586
580 self.mox.ReplayAll() 587 self.mox.ReplayAll()
581 588
582 retval = gcl.CMDcommit(['naame']) 589 retval = gcl.CMDcommit(['naame'])
583 self.assertEquals(retval, 0) 590 self.assertEquals(retval, 0)
584 self.assertEquals(change_info.description, 591 self.assertEquals(change_info.description,
585 'deescription\n\nCommitted: http://view/12345') 592 'deescription\n\nCommitted: http://view/12345')
586 # pylint: disable=W0212 593 # pylint: disable=W0212
587 self.assertTrue(change_info._deleted) 594 self.assertTrue(change_info._deleted)
588 self.assertTrue(change_info._closed) 595 self.assertTrue(change_info._closed)
596 self.assertEqual(
597 change_info._comments_added,
598 ["Committed manually as r12345 (presubmit successful)."])
589 599
590 600
591 if __name__ == '__main__': 601 if __name__ == '__main__':
592 import unittest 602 import unittest
593 unittest.main() 603 unittest.main()
OLDNEW
« no previous file with comments | « git_cl.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698