diff --git a/kairon/events/utility.py b/kairon/events/utility.py index 1129e0698..f201b2613 100644 --- a/kairon/events/utility.py +++ b/kairon/events/utility.py @@ -71,4 +71,4 @@ def stop_channel_mail_reading(bot: str): mail_processor.update_event_id(None) KScheduler().delete_job(event_id) except Exception as e: - raise logger.error(f"Failed to stop mail reading for bot {bot}. Error: {str(e)}") + raise AppException(f"Failed to stop mail reading for bot {bot}. Error: {str(e)}") diff --git a/tests/unit_test/channels/mail_scheduler_test.py b/tests/unit_test/channels/mail_scheduler_test.py index f66996dd4..60b634b33 100644 --- a/tests/unit_test/channels/mail_scheduler_test.py +++ b/tests/unit_test/channels/mail_scheduler_test.py @@ -139,18 +139,6 @@ def test_request_stop_success(mock_execute_http_request, mock_get_event_server_u except AppException: pytest.fail("request_epoch() raised AppException unexpectedly!") -@patch('kairon.shared.channels.mail.processor.MailProcessor.does_mail_channel_exist') -@patch('kairon.shared.channels.mail.scheduler.Utility.get_event_server_url') -@patch('kairon.shared.channels.mail.scheduler.Utility.execute_http_request') -def test_request_stop_success(mock_execute_http_request, mock_get_event_server_url, mock_imp): - mock_get_event_server_url.return_value = "http://localhost" - mock_execute_http_request.return_value = {'success': True} - mock_imp.return_value = True - bot = "test_bot" - try: - MailScheduler.request_stop(bot) - except AppException: - pytest.fail("request_epoch() raised AppException unexpectedly!") @patch('kairon.shared.channels.mail.processor.MailProcessor.does_mail_channel_exist') @patch('kairon.shared.channels.mail.scheduler.Utility.get_event_server_url')