test(api): create api_client pytest fixture (#1990)

This commit is contained in:
Jonas L 2022-07-25 21:21:21 +02:00 committed by GitHub
parent 2b973b2695
commit 04c0b11901
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,12 @@
import pytest
from django.conf import settings
from rest_framework.test import APIClient
@pytest.fixture()
def api_client():
obj = APIClient()
obj.credentials(
HTTP_AUTHORIZATION=f"Api-Key {settings.CONFIG.general.api_key}",
)
return obj