aboutsummaryrefslogblamecommitdiffstats
path: root/alphabetlearning/users/tests/test_tasks.py
blob: 92f0e8a85e395ae8a2742ce0b0cd3b84b5ff17f1 (plain) (tree)
1
2
3
4
5


                                     

                                                              











                                                                  
import pytest
from celery.result import EagerResult

from alphabetlearning.users.tasks import get_users_count
from alphabetlearning.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