Changeset View
Changeset View
Standalone View
Standalone View
swh/web/tests/conftest.py
Show First 20 Lines • Show All 77 Lines • ▼ Show 20 Lines | |||||
# Clear Django cache before each test | # Clear Django cache before each test | ||||
@pytest.fixture(autouse=True) | @pytest.fixture(autouse=True) | ||||
def django_cache_cleared(): | def django_cache_cleared(): | ||||
cache.clear() | cache.clear() | ||||
# Alias rf fixture from pytest-django | |||||
@pytest.fixture | |||||
def request_factory(rf): | |||||
return rf | |||||
# Fixture to get test client from Django REST Framework | # Fixture to get test client from Django REST Framework | ||||
@pytest.fixture(scope='module') | @pytest.fixture(scope='module') | ||||
def api_client(): | def api_client(): | ||||
return APIClient() | return APIClient() | ||||
# Fixture to get API request factory from Django REST Framework | # Fixture to get API request factory from Django REST Framework | ||||
@pytest.fixture(scope='module') | @pytest.fixture(scope='module') | ||||
▲ Show 20 Lines • Show All 203 Lines • Show Last 20 Lines |