Spaces:
Sleeping
Sleeping
Download tests/test_server_web_launch.py from isHeSatoshi/RevLogiXenv: direct link, hf CLI and curl.
- Browser
- Download file 878 Bytes
-
https://huggingface.co/spaces/isHeSatoshi/RevLogiXenv/resolve/main/tests/test_server_web_launch.py
- Command line
-
hf download hf://spaces/isHeSatoshi/RevLogiXenv/tests/test_server_web_launch.py
-
curl -L -o test_server_web_launch.py https://huggingface.co/spaces/isHeSatoshi/RevLogiXenv/resolve/main/tests/test_server_web_launch.py
878 Bytes
| from __future__ import annotations | |
| from fastapi import FastAPI | |
| from fastapi.testclient import TestClient | |
| from server.app import build_app | |
| def test_build_app_returns_fastapi_instance() -> None: | |
| app = build_app() | |
| assert isinstance(app, FastAPI) | |
| def test_build_app_web_enabled_mounts_web(monkeypatch) -> None: | |
| monkeypatch.setenv("ENABLE_WEB_INTERFACE", "true") | |
| app = build_app() | |
| client = TestClient(app) | |
| response = client.get("/web/", follow_redirects=True) | |
| assert response.status_code == 404 | |
| def test_build_app_default_non_web_still_serves_health(monkeypatch) -> None: | |
| monkeypatch.delenv("ENABLE_WEB_INTERFACE", raising=False) | |
| app = build_app() | |
| client = TestClient(app) | |
| health = client.get("/health") | |
| assert health.status_code == 200 | |
| web = client.get("/web/", follow_redirects=True) | |
| assert web.status_code == 404 | |