| 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 2476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2487 | 2487 |
| 2488 if author_counts_as_owner: | 2488 if author_counts_as_owner: |
| 2489 people.add(change.author_email) | 2489 people.add(change.author_email) |
| 2490 fake_db.files_not_covered_by(set(['foo/xyz.cc']), | 2490 fake_db.files_not_covered_by(set(['foo/xyz.cc']), |
| 2491 people).AndReturn(uncovered_files) | 2491 people).AndReturn(uncovered_files) |
| 2492 else: | 2492 else: |
| 2493 people.discard(change.author_email) | 2493 people.discard(change.author_email) |
| 2494 fake_db.files_not_covered_by(set(['foo/xyz.cc']), | 2494 fake_db.files_not_covered_by(set(['foo/xyz.cc']), |
| 2495 people).AndReturn(uncovered_files) | 2495 people).AndReturn(uncovered_files) |
| 2496 if not is_committing and uncovered_files: | 2496 if not is_committing and uncovered_files: |
| 2497 fake_db.reviewers_for(set(['foo/xyz.cc']), | 2497 fake_db.reviewers_for(set(['foo']), |
| 2498 change.author_email).AndReturn(change.author_email) | 2498 change.author_email).AndReturn(change.author_email) |
| 2499 | 2499 |
| 2500 self.mox.ReplayAll() | 2500 self.mox.ReplayAll() |
| 2501 output = presubmit.PresubmitOutput() | 2501 output = presubmit.PresubmitOutput() |
| 2502 results = presubmit_canned_checks.CheckOwners(input_api, | 2502 results = presubmit_canned_checks.CheckOwners(input_api, |
| 2503 presubmit.OutputApi, author_counts_as_owner=author_counts_as_owner) | 2503 presubmit.OutputApi, author_counts_as_owner=author_counts_as_owner) |
| 2504 if results: | 2504 if results: |
| 2505 results[0].handle(output) | 2505 results[0].handle(output) |
| 2506 self.assertEquals(output.getvalue(), expected_output) | 2506 self.assertEquals(output.getvalue(), expected_output) |
| 2507 | 2507 |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2724 owners_check=False) | 2724 owners_check=False) |
| 2725 self.assertEqual(1, len(results)) | 2725 self.assertEqual(1, len(results)) |
| 2726 self.assertEqual( | 2726 self.assertEqual( |
| 2727 'Found line ending with white spaces in:', results[0]._message) | 2727 'Found line ending with white spaces in:', results[0]._message) |
| 2728 self.checkstdout('') | 2728 self.checkstdout('') |
| 2729 | 2729 |
| 2730 | 2730 |
| 2731 if __name__ == '__main__': | 2731 if __name__ == '__main__': |
| 2732 import unittest | 2732 import unittest |
| 2733 unittest.main() | 2733 unittest.main() |
| OLD | NEW |