mirror of
https://github.com/leaders-of-digital-9-task/backend.git
synced 2025-02-22 18:50:33 +03:00
17 lines
507 B
Python
17 lines
507 B
Python
import pytest
|
|
from celery.result import EagerResult
|
|
|
|
from image_markuper.users.tasks import get_users_count
|
|
from image_markuper.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."""
|
|
UserFactory.create_batch(3)
|
|
settings.CELERY_TASK_ALWAYS_EAGER = True
|
|
task_result = get_users_count.delay()
|
|
assert isinstance(task_result, EagerResult)
|
|
assert task_result.result == 3
|