def test_can_sign_solved_reports(self): e = LibraryEnvError("first", "second", "third") for report in e.args: if report == "second": e.sign_processed(report) self.assertEqual(["first", "third"], e.unprocessed)
def test_report_unprocessed_library_env_errors(self, mock_process_report): report1 = ReportItem.error("OTHER ERROR", info={}) report2 = ReportItem.error("OTHER ERROR", info={}) report3 = ReportItem.error("OTHER ERROR", info={}) e = LibraryEnvError(report1, report2, report3) e.sign_processed(report2) mock_middleware = mock.Mock(side_effect=e) binded = bind(cli_env=None, run_with_middleware=mock_middleware, run_library_command=None) self.assertRaises(SystemExit, lambda: binded(cli_env=None)) mock_process_report.assert_called_once_with([report1, report3])
def test_report_unprocessed_library_env_errors(self, mock_process_report): report1 = ReportItem.error("OTHER ERROR", "", info={}) report2 = ReportItem.error("OTHER ERROR", "", info={}) report3 = ReportItem.error("OTHER ERROR", "", info={}) e = LibraryEnvError(report1, report2, report3) e.sign_processed(report2) mock_middleware = mock.Mock(side_effect=e) binded = bind( cli_env=None, run_with_middleware=mock_middleware, run_library_command=None ) self.assertRaises(SystemExit, lambda: binded(cli_env=None)) mock_process_report.assert_called_once_with([report1, report3])