Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: sitescripts/hg/test/update_issues.py

Issue 29344546: Issue 4070 - Correctly handle multiline commit messages in the mercurial hook (Closed)
Patch Set: Created May 25, 2016, 5:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # This file is part of the Adblock Plus web scripts, 1 # This file is part of the Adblock Plus web scripts,
2 # Copyright (C) 2006-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 Eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 'Fixes 1337 no dash' 132 'Fixes 1337 no dash'
133 ], warning_count=7) 133 ], warning_count=7)
134 134
135 def test_noissue_commits_ignored(self): 135 def test_noissue_commits_ignored(self):
136 self._run_hook(['Noissue - Foo', 'noissue - Bar']) # No updates. 136 self._run_hook(['Noissue - Foo', 'noissue - Bar']) # No updates.
137 137
138 def test_single_issue_referenced(self): 138 def test_single_issue_referenced(self):
139 updates = self._run_hook(['Issue 1337 - Foo'], update_count=1) 139 updates = self._run_hook(['Issue 1337 - Foo'], update_count=1)
140 self.assertEqual(updates[0][0][0], 1337) 140 self.assertEqual(updates[0][0][0], 1337)
141 141
142 def test_multiline_commit_message(self):
143 updates = self._run_hook(['Issue 1337 - Foo\nBar',
144 'Issue 1337 - Bar.\nBaz',
145 'Fixes 2448 - Foo\n\nBar'],
146 update_count=2)
147 comment_1337 = updates[0][0][1]
148 self.assertIn('Issue 1337 - Foo...]', comment_1337)
149 self.assertIn('Issue 1337 - Bar...]', comment_1337)
150 comment_2448 = updates[1][0][1]
151 self.assertIn('Fixes 2448 - Foo]', comment_2448)
152
142 def test_missing_issue_referenced(self): 153 def test_missing_issue_referenced(self):
143 self._run_hook(['Issue 42 - Bar'], warning_count=1) 154 self._run_hook(['Issue 42 - Bar'], warning_count=1)
144 155
145 def test_multiple_issues_referenced(self): 156 def test_multiple_issues_referenced(self):
146 updates = self._run_hook(['Issue 1337, fixes 2448 - Foo'], 157 updates = self._run_hook(['Issue 1337, fixes 2448 - Foo'],
147 update_count=2) 158 update_count=2)
148 self.assertEqual(updates[0][0][0], 1337) 159 self.assertEqual(updates[0][0][0], 1337)
149 self.assertEqual(updates[1][0][0], 2448) 160 self.assertEqual(updates[1][0][0], 2448)
150 161
151 def test_multiple_commits_for_issue(self): 162 def test_multiple_commits_for_issue(self):
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 218
208 def test_fix_nonexistent(self): 219 def test_fix_nonexistent(self):
209 self._run_hook(['Fixes 7331 - Foo'], warning_count=1) 220 self._run_hook(['Fixes 7331 - Foo'], warning_count=1)
210 221
211 def test_fix_closed_with_assigned_milestone(self): 222 def test_fix_closed_with_assigned_milestone(self):
212 self._run_hook(['fixes 3559 - Foo']) # No updates. 223 self._run_hook(['fixes 3559 - Foo']) # No updates.
213 224
214 225
215 if __name__ == '__main__': 226 if __name__ == '__main__':
216 unittest.main() 227 unittest.main()
OLDNEW
« sitescripts/hg/bin/update_issues.py ('K') | « sitescripts/hg/template/issue_commit_comment.tmpl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld