def setUp(self): self.status = LoggerStatus( unknown=sentinel.unknown, errors=sentinel.errors, warnings=sentinel.warnings, important=sentinel.important, )
def setUp(self): self.mock_list_messages = self.patch( 'pignacio_scripts.nagios.logger.list_messages', autospec=True) self.mock_get_first_line = self.patch( 'pignacio_scripts.nagios.logger.get_first_line', autospec=True) list_message_returns = { sentinel.errors: [sentinel.listed_errors], sentinel.warnings: [sentinel.listed_warnings], sentinel.important: [sentinel.listed_important], } self.mock_list_messages.side_effect = ( lambda x, *a, **kw: list_message_returns.get(x, [])) self.mock_get_first_line.return_value = sentinel.first_line self.status = LoggerStatus( unknown=sentinel.unknown, errors=sentinel.errors, warnings=sentinel.warnings, important=sentinel.important, )
def setUp(self): self.mock_get_output = self.patch( 'pignacio_scripts.nagios.logger.get_output', autospec=True) self.mock_get_output.return_value = sentinel.output self.mock_print_lines = self.patch( 'pignacio_scripts.nagios.logger.print_lines', autospec=True) self.mock_sys_exit = self.patch( 'pignacio_scripts.nagios.logger.sys.exit', autospec=True) self.mock_empty_to_whitespace = self.patch( 'pignacio_scripts.nagios.logger.empty_lines_to_whitespace', autospec=True) self.mock_empty_to_whitespace.return_value = sentinel.whitespace_output self.status = LoggerStatus( unknown=sentinel.unknown, warnings=sentinel.warnings, errors=sentinel.errors, important=sentinel.important, ) self.mock_exit_code = self.patch_object(self.status, 'exit_code', autospec=True) self.mock_exit_code.return_value = sentinel.exit_code