Resolves https://github.com/webrecorder/browsertrix/issues/2048 --------- Co-authored-by: Ilya Kreymer <ikreymer@gmail.com> Co-authored-by: Henry Wilkinson <henry@wilkinson.graphics>
54 lines
1.3 KiB
Python
54 lines
1.3 KiB
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"
|
|
|
|
|
|
def test_api_settings():
|
|
r = requests.get(f"{API_PREFIX}/settings")
|
|
assert r.status_code == 200
|
|
|
|
data = r.json()
|
|
|
|
assert data == {
|
|
"registrationEnabled": False,
|
|
"jwtTokenLifetime": 86400,
|
|
"defaultBehaviorTimeSeconds": 300,
|
|
"maxPagesPerCrawl": 4,
|
|
"numBrowsers": 2,
|
|
"maxScale": 3,
|
|
"defaultPageLoadTimeSeconds": 120,
|
|
"billingEnabled": True,
|
|
"signUpUrl": "",
|
|
"salesEmail": "",
|
|
"supportEmail": "",
|
|
}
|