| OLD | NEW |
| 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 Loading... |
| 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 'Fixes 2448 - Bar\n \nBaz'], |
| 147 update_count=2) |
| 148 comment_1337 = updates[0][0][1] |
| 149 self.assertIn('Issue 1337 - Foo...]', comment_1337) |
| 150 self.assertIn('Issue 1337 - Bar...]', comment_1337) |
| 151 comment_2448 = updates[1][0][1] |
| 152 self.assertIn('Fixes 2448 - Foo]', comment_2448) |
| 153 self.assertIn('Fixes 2448 - Bar]', comment_2448) |
| 154 |
| 155 def test_multiline_commit_message_crlf(self): |
| 156 updates = self._run_hook(['Issue 1337 - Foo\r\nBar', |
| 157 'Issue 1337 - Bar.\r\nBaz', |
| 158 'Fixes 2448 - Foo\r\n\r\nBar', |
| 159 'Fixes 2448 - Bar\r\n \r\nBaz'], |
| 160 update_count=2) |
| 161 comment_1337 = updates[0][0][1] |
| 162 self.assertIn('Issue 1337 - Foo...]', comment_1337) |
| 163 self.assertIn('Issue 1337 - Bar...]', comment_1337) |
| 164 comment_2448 = updates[1][0][1] |
| 165 self.assertIn('Fixes 2448 - Foo]', comment_2448) |
| 166 self.assertIn('Fixes 2448 - Bar]', comment_2448) |
| 167 |
| 142 def test_missing_issue_referenced(self): | 168 def test_missing_issue_referenced(self): |
| 143 self._run_hook(['Issue 42 - Bar'], warning_count=1) | 169 self._run_hook(['Issue 42 - Bar'], warning_count=1) |
| 144 | 170 |
| 145 def test_multiple_issues_referenced(self): | 171 def test_multiple_issues_referenced(self): |
| 146 updates = self._run_hook(['Issue 1337, fixes 2448 - Foo'], | 172 updates = self._run_hook(['Issue 1337, fixes 2448 - Foo'], |
| 147 update_count=2) | 173 update_count=2) |
| 148 self.assertEqual(updates[0][0][0], 1337) | 174 self.assertEqual(updates[0][0][0], 1337) |
| 149 self.assertEqual(updates[1][0][0], 2448) | 175 self.assertEqual(updates[1][0][0], 2448) |
| 150 | 176 |
| 151 def test_multiple_commits_for_issue(self): | 177 def test_multiple_commits_for_issue(self): |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 233 |
| 208 def test_fix_nonexistent(self): | 234 def test_fix_nonexistent(self): |
| 209 self._run_hook(['Fixes 7331 - Foo'], warning_count=1) | 235 self._run_hook(['Fixes 7331 - Foo'], warning_count=1) |
| 210 | 236 |
| 211 def test_fix_closed_with_assigned_milestone(self): | 237 def test_fix_closed_with_assigned_milestone(self): |
| 212 self._run_hook(['fixes 3559 - Foo']) # No updates. | 238 self._run_hook(['fixes 3559 - Foo']) # No updates. |
| 213 | 239 |
| 214 | 240 |
| 215 if __name__ == '__main__': | 241 if __name__ == '__main__': |
| 216 unittest.main() | 242 unittest.main() |
| OLD | NEW |