def test_empty_state(self): options = MockOptions() options.reviewer = 'MOCK reviewer' options.git_commit = 'MOCK git commit' step = UpdateChangeLogsWithReviewer(MockTool(), options) with OutputCapture(level=logging.INFO) as captured: step.run({}) self.assertEqual(captured.root.log.getvalue(), '')
def test_empty_state(self): capture = OutputCapture() options = MockOptions() options.reviewer = 'MOCK reviewer' options.git_commit = 'MOCK git commit' step = UpdateChangeLogsWithReviewer(MockTool(), options) capture.assert_outputs(self, step.run, [{}])
def test_guess_reviewer_from_multipatch_bug(self): capture = OutputCapture() step = UpdateChangeLogsWithReviewer(MockTool(), MockOptions()) expected_stderr = "Guessing \"Reviewer2\" as reviewer from attachment 10001 on bug 50000.\n" capture.assert_outputs(self, step._guess_reviewer_from_bug, [50000], expected_stderr=expected_stderr)
def test_guess_reviewer_from_bug(self): capture = OutputCapture() step = UpdateChangeLogsWithReviewer(MockTool(), MockOptions()) expected_stderr = "No reviewed patches on bug 50001, cannot infer reviewer.\n" capture.assert_outputs(self, step._guess_reviewer_from_bug, [50001], expected_stderr=expected_stderr)
def test_empty_state(self): capture = OutputCapture() step = UpdateChangeLogsWithReviewer(MockTool(), MockOptions()) capture.assert_outputs(self, step.run, [{}])
def test_guess_reviewer_from_multipatch_bug(self): step = UpdateChangeLogsWithReviewer(MockTool(), MockOptions()) with OutputCapture(level=logging.INFO) as captured: step._guess_reviewer_from_bug(50000) self.assertEqual(captured.root.log.getvalue(), 'Guessing "Reviewer2" as reviewer from attachment 10001 on bug 50000.\n')
def test_guess_reviewer_from_bug(self): step = UpdateChangeLogsWithReviewer(MockTool(), MockOptions()) with OutputCapture(level=logging.INFO) as captured: step._guess_reviewer_from_bug(50001) self.assertEqual(captured.root.log.getvalue(), 'No reviewed patches on bug 50001, cannot infer reviewer.\n')