Changeset View
Changeset View
Standalone View
Standalone View
swh/auth/tests/conftest.py
# Copyright (C) 2021 The Software Heritage developers | # Copyright (C) 2021 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU Affero General Public License version 3, or any later version | # License: GNU Affero General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import pytest | import pytest | ||||
from rest_framework.test import APIClient, APIRequestFactory | |||||
# Alias rf fixture from pytest-django | # Alias rf fixture from pytest-django | ||||
@pytest.fixture | @pytest.fixture | ||||
def request_factory(rf): | def request_factory(rf): | ||||
return rf | return rf | ||||
# Fixture to get test client from Django REST Framework | |||||
@pytest.fixture(scope="module") | |||||
def api_client(): | |||||
return APIClient() | |||||
# Fixture to get API request factory from Django REST Framework | |||||
@pytest.fixture(scope="module") | |||||
def api_request_factory(): | |||||
return APIRequestFactory() |