diff --git a/atst/queue.py b/atst/queue.py index befe45b0..9793ee33 100644 --- a/atst/queue.py +++ b/atst/queue.py @@ -30,6 +30,9 @@ class ATSTQueue(RQ): def send_mail(self, recipients, subject, body): self._queue_job(ATSTQueue._send_mail, recipients, subject, body) + def send_notification_mail(self, recipients, subject, body): + self._queue_job(ATSTQueue._send_mail, recipients, subject, body) + # pylint: disable=pointless-string-statement """Class methods to actually perform the work. diff --git a/atst/utils/notification_sender.py b/atst/utils/notification_sender.py index 0fdc31b0..dbf11a96 100644 --- a/atst/utils/notification_sender.py +++ b/atst/utils/notification_sender.py @@ -20,7 +20,7 @@ class NotificationSender(object): recipients, body ) ) - self.queue.send_mail(recipients, self.EMAIL_SUBJECT, body) + self.queue.send_notification_mail(recipients, self.EMAIL_SUBJECT, body) def _get_recipients(self, type_): query = select([NotificationRecipient.email]) diff --git a/tests/conftest.py b/tests/conftest.py index 31f836fa..c46c4436 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -310,7 +310,7 @@ def mock_logger(app): @pytest.fixture -def mock_notification_sender(app): +def notification_sender(app): real_notification_sender = app.notification_sender app.notification_sender = FakeNotificationSender() diff --git a/tests/utils/test_notification_sender.py b/tests/utils/test_notification_sender.py index 458433c7..df5efaa7 100644 --- a/tests/utils/test_notification_sender.py +++ b/tests/utils/test_notification_sender.py @@ -22,6 +22,6 @@ def test_can_send_notification(mock_queue, notification_sender): NotificationRecipientFactory.create(email=recipient_email) notification_sender.send(email_body) - mock_queue.send_mail.assert_called_once_with( + mock_queue.send_notification_mail.assert_called_once_with( ("test@example.com",), notification_sender.EMAIL_SUBJECT, email_body )