- Updates the `/docs` and `/redoc` API endpoints to have better metadata, including using Browsertrix favicon and our logo for the `/redoc` endpoint. - add new logo file 'docs-logo.svg' to root Based on info at: https://fastapi.tiangolo.com/how-to/extending-openapi/ https://fastapi.tiangolo.com/tutorial/metadata/ --------- Co-authored-by: Henry Wilkinson <henry@wilkinson.graphics>
33 lines
777 B
Python
33 lines
777 B
Python
import requests
|
|
|
|
from .conftest import API_PREFIX
|
|
|
|
|
|
def test_api_docs():
|
|
r = requests.get(f"{API_PREFIX}/docs")
|
|
assert r.status_code == 200
|
|
|
|
text = r.text
|
|
assert "<title>Browsertrix API</title>" in text
|
|
assert "/favicon.ico" in text
|
|
assert "/api/openapi.json" in text
|
|
|
|
|
|
def test_api_redoc():
|
|
r = requests.get(f"{API_PREFIX}/redoc")
|
|
assert r.status_code == 200
|
|
|
|
text = r.text
|
|
assert "<title>Browsertrix API</title>" in text
|
|
assert "/favicon.ico" in text
|
|
assert "/api/openapi.json" in text
|
|
|
|
|
|
def test_api_openapi():
|
|
r = requests.get(f"{API_PREFIX}/openapi.json")
|
|
assert r.status_code == 200
|
|
|
|
json = r.json()
|
|
assert json["info"]["title"] == "Browsertrix"
|
|
assert json["info"]["x-logo"]["url"] == "/docs-logo.svg"
|