2023-09-27 17:04:07 +00:00
|
|
|
from unittest.mock import patch
|
2023-09-27 16:54:57 +00:00
|
|
|
from application.core.settings import settings
|
2024-06-12 11:48:28 +00:00
|
|
|
from application.celery_init import make_celery
|
2023-09-27 16:54:57 +00:00
|
|
|
|
|
|
|
|
2024-06-19 08:17:09 +00:00
|
|
|
@patch('application.celery_init.Celery')
|
2023-09-27 16:54:57 +00:00
|
|
|
def test_make_celery(mock_celery):
|
|
|
|
# Arrange
|
|
|
|
app_name = 'test_app_name'
|
|
|
|
|
|
|
|
# Act
|
|
|
|
celery = make_celery(app_name)
|
|
|
|
|
|
|
|
# Assert
|
2023-10-01 20:34:57 +00:00
|
|
|
mock_celery.assert_called_once_with(
|
|
|
|
app_name,
|
|
|
|
broker=settings.CELERY_BROKER_URL,
|
|
|
|
backend=settings.CELERY_RESULT_BACKEND
|
|
|
|
)
|
2023-09-27 16:54:57 +00:00
|
|
|
celery.conf.update.assert_called_once_with(settings)
|
|
|
|
assert celery == mock_celery.return_value
|