Skip to content

Commit

Permalink
Update inform_mailing_list unittest
Browse files Browse the repository at this point in the history
Signed-off-by: Tarun Arora <[email protected]>
  • Loading branch information
Tarun-Arora committed Sep 3, 2023
1 parent d04c7fe commit b33198c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/test_ci/test_controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,10 @@ def test_customizedtest_added_to_queue(self):
self.assertIn(2, customized_test)
self.assertNotIn(1, customized_test)

@mock.patch('flask.g.log.error')
@mock.patch('mailer.Mailer')
@mock.patch('mod_ci.controllers.get_html_issue_body')
def test_inform_mailing_list(self, mock_get_html_issue_body, mock_email):
def test_inform_mailing_list(self, mock_get_html_issue_body, mock_email, mock_log_error):
"""Test the inform_mailing_list function."""
from mod_ci.controllers import inform_mailing_list

Expand All @@ -500,6 +501,11 @@ def test_inform_mailing_list(self, mock_get_html_issue_body, mock_email):
}
)
mock_get_html_issue_body.assert_called_once()
mock_log_error.assert_not_called()

mock_email.send_simple_message.return_value = False
inform_mailing_list(mock_email, "matejmecka", "2430", "Some random string", "Lorem Ipsum sit dolor amet...")
mock_log_error.assert_called_once()

@staticmethod
@mock.patch('mod_ci.controllers.markdown')
Expand Down

0 comments on commit b33198c

Please sign in to comment.