# Which issue(s) this PR fixes - Fix issue that was causing our openapi schema to return HTTP 500 + add an integration test which fetches the `.yaml` schema and validates that the endpoint returns HTTP 200 (should hopefully prevent this from happening again). - add a few more type hints along the way ## Checklist - [x] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required)
17 lines
517 B
Python
17 lines
517 B
Python
import pytest
|
|
import yaml
|
|
from django.urls import reverse
|
|
from rest_framework import status
|
|
from rest_framework.test import APIClient
|
|
|
|
|
|
@pytest.mark.django_db
|
|
def test_fetching_the_openapi_schema_works(settings, reload_urls):
|
|
settings.DRF_SPECTACULAR_ENABLED = True
|
|
reload_urls()
|
|
|
|
client = APIClient()
|
|
response = client.get(reverse("schema"))
|
|
|
|
assert response.status_code == status.HTTP_200_OK
|
|
assert yaml.safe_load(response.content)["info"]["title"] == settings.SPECTACULAR_SETTINGS["TITLE"]
|