|
|
@ -4,6 +4,8 @@ from pathlib import Path |
|
|
import pytest |
|
|
import pytest |
|
|
from fastapi.testclient import TestClient |
|
|
from fastapi.testclient import TestClient |
|
|
|
|
|
|
|
|
|
|
|
from tests.utils import workdir_lock |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.fixture(scope="module") |
|
|
@pytest.fixture(scope="module") |
|
|
def client(): |
|
|
def client(): |
|
|
@ -17,6 +19,7 @@ def client(): |
|
|
static_dir.rmdir() |
|
|
static_dir.rmdir() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@workdir_lock |
|
|
def test_swagger_ui_html(client: TestClient): |
|
|
def test_swagger_ui_html(client: TestClient): |
|
|
response = client.get("/docs") |
|
|
response = client.get("/docs") |
|
|
assert response.status_code == 200, response.text |
|
|
assert response.status_code == 200, response.text |
|
|
@ -24,18 +27,21 @@ def test_swagger_ui_html(client: TestClient): |
|
|
assert "https://unpkg.com/swagger-ui-dist@5/swagger-ui.css" in response.text |
|
|
assert "https://unpkg.com/swagger-ui-dist@5/swagger-ui.css" in response.text |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@workdir_lock |
|
|
def test_swagger_ui_oauth2_redirect_html(client: TestClient): |
|
|
def test_swagger_ui_oauth2_redirect_html(client: TestClient): |
|
|
response = client.get("/docs/oauth2-redirect") |
|
|
response = client.get("/docs/oauth2-redirect") |
|
|
assert response.status_code == 200, response.text |
|
|
assert response.status_code == 200, response.text |
|
|
assert "window.opener.swaggerUIRedirectOauth2" in response.text |
|
|
assert "window.opener.swaggerUIRedirectOauth2" in response.text |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@workdir_lock |
|
|
def test_redoc_html(client: TestClient): |
|
|
def test_redoc_html(client: TestClient): |
|
|
response = client.get("/redoc") |
|
|
response = client.get("/redoc") |
|
|
assert response.status_code == 200, response.text |
|
|
assert response.status_code == 200, response.text |
|
|
assert "https://unpkg.com/redoc@2/bundles/redoc.standalone.js" in response.text |
|
|
assert "https://unpkg.com/redoc@2/bundles/redoc.standalone.js" in response.text |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@workdir_lock |
|
|
def test_api(client: TestClient): |
|
|
def test_api(client: TestClient): |
|
|
response = client.get("/users/john") |
|
|
response = client.get("/users/john") |
|
|
assert response.status_code == 200, response.text |
|
|
assert response.status_code == 200, response.text |
|
|
|