Skip to content

Commit

Permalink
mail read schedule stop mechanism, filters and their related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
spandan_mondal committed Dec 12, 2024
1 parent 4116ea2 commit 1c6fa33
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
2 changes: 1 addition & 1 deletion kairon/events/utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}")
12 changes: 0 additions & 12 deletions tests/unit_test/channels/mail_scheduler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 1c6fa33

Please sign in to comment.