"""Smoke tier — every GET view renders, and the brand static layer is mounted."""

from __future__ import annotations

import pytest
from fastapi.testclient import TestClient

GET_ROUTES = [
    "/",
    "/vms",
    "/vms/new",
    "/volumes",
    "/floating-ips",
    "/security-groups",
    "/keypairs",
    "/objects",
]


@pytest.mark.smoke
@pytest.mark.parametrize("path", GET_ROUTES)
def test_get_view_renders(client: TestClient, path: str) -> None:
    resp = client.get(path)
    assert resp.status_code == 200
    assert "text/html" in resp.headers["content-type"]


@pytest.mark.smoke
@pytest.mark.parametrize(
    "asset",
    [
        "/static/brand/tokens.css",
        "/static/brand/base.css",
        "/static/brand/components.css",
        "/static/brand/fonts.css",
        "/static/app.css",
    ],
)
def test_brand_css_served(client: TestClient, asset: str) -> None:
    resp = client.get(asset)
    assert resp.status_code == 200
    assert "text/css" in resp.headers["content-type"]


@pytest.mark.smoke
def test_brand_font_served(client: TestClient) -> None:
    resp = client.get("/static/brand/fonts/inter-latin.woff2")
    assert resp.status_code == 200
    # The .woff2 content-type depends on the OS mime DB (slim CI images map it to
    # application/octet-stream), so verify the bytes are a real WOFF2 file (the
    # "wOF2" magic signature) rather than the environment-dependent header.
    assert resp.content[:4] == b"wOF2"


@pytest.mark.smoke
def test_vendored_htmx_served(client: TestClient) -> None:
    # The htmx uplift is self-hosted (no CDN); guard that it ships in the wheel.
    resp = client.get("/static/vendor/htmx.min.js")
    assert resp.status_code == 200
    assert "javascript" in resp.headers["content-type"]
