From efbbd480ddc62e695123d31c31d233b0df5155bd Mon Sep 17 00:00:00 2001 From: Matthew Lemon Date: Mon, 13 May 2024 17:26:25 +0100 Subject: After first pre-commit processing --- pyblackbird_cc/users/tests/test_tasks.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 pyblackbird_cc/users/tests/test_tasks.py (limited to 'pyblackbird_cc/users/tests/test_tasks.py') diff --git a/pyblackbird_cc/users/tests/test_tasks.py b/pyblackbird_cc/users/tests/test_tasks.py new file mode 100644 index 0000000..6282bfb --- /dev/null +++ b/pyblackbird_cc/users/tests/test_tasks.py @@ -0,0 +1,17 @@ +import pytest +from celery.result import EagerResult + +from pyblackbird_cc.users.tasks import get_users_count +from pyblackbird_cc.users.tests.factories import UserFactory + +pytestmark = pytest.mark.django_db + + +def test_user_count(settings): + """A basic test to execute the get_users_count Celery task.""" + batch_size = 3 + UserFactory.create_batch(batch_size) + settings.CELERY_TASK_ALWAYS_EAGER = True + task_result = get_users_count.delay() + assert isinstance(task_result, EagerResult) + assert task_result.result == batch_size -- cgit v1.2.3