| OLD | NEW |
| 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 presubmit_support.py and presubmit_canned_checks.py.""" | 6 """Unit tests for presubmit_support.py and presubmit_canned_checks.py.""" |
| 7 | 7 |
| 8 # pylint: disable=E1101,E1103 | 8 # pylint: disable=E1101,E1103 |
| 9 | 9 |
| 10 import logging | 10 import logging |
| (...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2224 expected_output= | 2224 expected_output= |
| 2225 'Missing LGTM from someone other than john@example.com\n') | 2225 'Missing LGTM from someone other than john@example.com\n') |
| 2226 | 2226 |
| 2227 self.AssertOwnersWorks( | 2227 self.AssertOwnersWorks( |
| 2228 approvers=set(), | 2228 approvers=set(), |
| 2229 reviewers=set(), | 2229 reviewers=set(), |
| 2230 is_committing=False, | 2230 is_committing=False, |
| 2231 rietveld_response=response, | 2231 rietveld_response=response, |
| 2232 expected_output='') | 2232 expected_output='') |
| 2233 | 2233 |
| 2234 def testCannedCheckOwners_NoIssue(self): | 2234 def testCannedCheckOwners_NoIssueNoFiles(self): |
| 2235 self.AssertOwnersWorks(issue=None, | 2235 self.AssertOwnersWorks(issue=None, |
| 2236 expected_output="OWNERS check failed: this change has no Rietveld " | 2236 expected_output="OWNERS check failed: this change has no Rietveld " |
| 2237 "issue number, so we can't check it for approvals.\n") | 2237 "issue number, so we can't check it for approvals.\n") |
| 2238 | |
| 2239 self.AssertOwnersWorks(issue=None, is_committing=False, | 2238 self.AssertOwnersWorks(issue=None, is_committing=False, |
| 2240 expected_output="") | 2239 expected_output="") |
| 2241 | 2240 |
| 2241 def testCannedCheckOwners_NoIssue(self): |
| 2242 self.AssertOwnersWorks(issue=None, |
| 2243 uncovered_dirs=set(['foo']), |
| 2244 expected_output="OWNERS check failed: this change has no Rietveld " |
| 2245 "issue number, so we can't check it for approvals.\n") |
| 2246 self.AssertOwnersWorks(issue=None, |
| 2247 is_committing=False, |
| 2248 uncovered_dirs=set(['foo']), |
| 2249 expected_output='Missing OWNER reviewers for files in these ' |
| 2250 'directories:\n' |
| 2251 ' foo\n' |
| 2252 'Until the issue is uploaded, this list will include ' |
| 2253 'directories for which you \n' |
| 2254 'are an OWNER.\n') |
| 2255 |
| 2242 def testCannedCheckOwners_NoLGTM(self): | 2256 def testCannedCheckOwners_NoLGTM(self): |
| 2243 self.AssertOwnersWorks(expected_output='Missing LGTM from someone ' | 2257 self.AssertOwnersWorks(expected_output='Missing LGTM from someone ' |
| 2244 'other than john@example.com\n') | 2258 'other than john@example.com\n') |
| 2245 self.AssertOwnersWorks(is_committing=False, expected_output='') | 2259 self.AssertOwnersWorks(is_committing=False, expected_output='') |
| 2246 | 2260 |
| 2247 def testCannedCheckOwners_OnlyOwnerLGTM(self): | 2261 def testCannedCheckOwners_OnlyOwnerLGTM(self): |
| 2248 self.AssertOwnersWorks(approvers=set(['john@example.com']), | 2262 self.AssertOwnersWorks(approvers=set(['john@example.com']), |
| 2249 expected_output='Missing LGTM from someone ' | 2263 expected_output='Missing LGTM from someone ' |
| 2250 'other than john@example.com\n') | 2264 'other than john@example.com\n') |
| 2251 self.AssertOwnersWorks(approvers=set(['john@example.com']), | 2265 self.AssertOwnersWorks(approvers=set(['john@example.com']), |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2365 owners_check=False) | 2379 owners_check=False) |
| 2366 self.assertEqual(1, len(results)) | 2380 self.assertEqual(1, len(results)) |
| 2367 self.assertEqual( | 2381 self.assertEqual( |
| 2368 'Found line ending with white spaces in:', results[0]._message) | 2382 'Found line ending with white spaces in:', results[0]._message) |
| 2369 self.checkstdout('') | 2383 self.checkstdout('') |
| 2370 | 2384 |
| 2371 | 2385 |
| 2372 if __name__ == '__main__': | 2386 if __name__ == '__main__': |
| 2373 import unittest | 2387 import unittest |
| 2374 unittest.main() | 2388 unittest.main() |
| OLD | NEW |