Use Celery instead of RQ.
Celery provides a more robust set of queueing options for both tasks and worker processes. Updates include: - infrastructure necessary to run Celery, including celery entrypoint - backgrounded functions are now imported directly from atst.jobs - update tests as-needed - update kubernetes worker pod command
This commit is contained in:
@@ -6,22 +6,19 @@ from atst.utils.notification_sender import NotificationSender
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def mock_queue(queue):
|
||||
return Mock(spec=queue)
|
||||
def notification_sender():
|
||||
return NotificationSender()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def notification_sender(mock_queue):
|
||||
return NotificationSender(mock_queue)
|
||||
|
||||
|
||||
def test_can_send_notification(mock_queue, notification_sender):
|
||||
def test_can_send_notification(monkeypatch, notification_sender):
|
||||
job_mock = Mock()
|
||||
monkeypatch.setattr("atst.jobs.send_notification_mail.delay", job_mock)
|
||||
recipient_email = "test@example.com"
|
||||
email_body = "This is a test"
|
||||
|
||||
NotificationRecipientFactory.create(email=recipient_email)
|
||||
notification_sender.send(email_body)
|
||||
|
||||
mock_queue.send_notification_mail.assert_called_once_with(
|
||||
job_mock.assert_called_once_with(
|
||||
("test@example.com",), notification_sender.EMAIL_SUBJECT, email_body
|
||||
)
|
||||
|
Reference in New Issue
Block a user