Spaces:
Sleeping
Sleeping
File size: 1,538 Bytes
ff293b1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | """Phase 1: scaffold, OpenEnv manifest, layout, and HTTP health surface."""
from pathlib import Path
import yaml
from starlette.testclient import TestClient
ROOT = Path(__file__).resolve().parents[1]
def test_openenv_yaml_exists_and_metadata():
path = ROOT / "openenv.yaml"
assert path.is_file(), "openenv.yaml must exist at project root"
data = yaml.safe_load(path.read_text(encoding="utf-8"))
assert data.get("name") == "ghostexec"
assert data.get("spec_version") == 1
assert data.get("type") == "space"
assert data.get("runtime") == "fastapi"
assert data.get("app") == "server.app:app"
desc = data.get("description")
assert desc and isinstance(desc, str) and len(desc.strip()) > 0
ver = data.get("version")
assert ver and isinstance(ver, str) and len(ver.strip()) > 0
def test_expected_folder_structure():
assert (ROOT / "models.py").is_file()
assert (ROOT / "client.py").is_file()
assert (ROOT / "pyproject.toml").is_file()
assert (ROOT / "server" / "app.py").is_file()
assert (ROOT / "server" / "ghostexec_environment.py").is_file()
assert (ROOT / "Dockerfile").is_file() or (ROOT / "server" / "Dockerfile").is_file()
assert (ROOT / "server" / "requirements.txt").is_file()
def test_server_health_ping():
from ghostexec.server.app import app
client = TestClient(app)
response = client.get("/health")
assert response.status_code == 200
assert response.json().get("status") == "healthy"
|