def test_Add_should_notify_the_user_when_an_OWTF_bug_is_found(self): error_handler = self._create_error_handler_with_core_mock() flexmock(error_handler) error_handler.should_receive("LogError").once() self.init_stdout_recording() error_handler.Add("Error message", BugType="owtf") stdout_content = self.get_recorded_stdout_and_close() assert_that(stdout_content is not None)
def test_Add_should_print_and_save_to_the_DB_a_non_OWTF_error(self): error_handler = self._create_error_handler_with_core_mock() flexmock(error_handler) error_handler.should_receive("LogError").once() self.init_stdout_recording() error_handler.Add("Error message", BugType="external") stdout_content = self.get_recorded_stdout_and_close() assert_that(stdout_content is not None)
def test_UserAbort_with_options_Exit_and_Command_should_raise_an_exception(self): error_handler = self._create_error_handler_with_core_mock() flexmock(error_handler) error_handler.should_receive("get_option_from_user").and_return("e").once() try: error_handler.UserAbort("Command") self.fail("Exception expected") except FrameworkAbortException: pass # Test passed
def test_UserAbort_with_options_Exit_and_Command_should_raise_an_exception( self): error_handler = self._create_error_handler_with_core_mock() flexmock(error_handler) error_handler.should_receive("get_option_from_user").and_return( "e").once() try: error_handler.UserAbort("Command") self.fail("Exception expected") except FrameworkAbortException: pass # Test passed
def test_UserAbort_with_options_Exit_and_Next_plugin_should_raise_and_exception(self): error_handler = self._create_error_handler_with_core_mock() flexmock(error_handler) error_handler.should_receive("get_option_from_user").and_return("p").once() self.assertRaises(PluginAbortException, error_handler.UserAbort, "Plugin")
def test_UserAbort_with_options_Exit_and_Command_should_raise_an_exception(self): error_handler = self._create_error_handler_with_core_mock() flexmock(error_handler) error_handler.should_receive("get_option_from_user").and_return("e").once() self.assertRaises(FrameworkAbortException, error_handler.UserAbort, "Command")