19 lines
620 B
Python
19 lines
620 B
Python
# conftest.py
|
|
import pytest
|
|
import uuid
|
|
from django.contrib.auth import get_user_model
|
|
|
|
@pytest.fixture
|
|
def test_user():
|
|
return get_user_model().objects.create_user(
|
|
username=f"user_{uuid.uuid4().hex[:8]}",
|
|
email=f"user+{uuid.uuid4().hex[:8]}@example.test",
|
|
password="pass"
|
|
)
|
|
|
|
@pytest.fixture(autouse=True)
|
|
def setup_test_celery_settings(settings):
|
|
settings.CELERY_TASK_ALWAYS_EAGER = True
|
|
settings.CELERY_TASK_EAGER_PROPAGATES=True # Ovo osigurava da greške u tasku odmah pucaju u testu
|
|
settings.BROKER_BACKEND='memory', # Koristi in-memory broker umjesto Redis-a
|