"""TDD — musehub#191 (acceptance criterion 3): the "muse --version" sample output on /muse/getting-started must show the real installable muse CLI tarball version, not musehub's own unrelated app version. The page's example output block used the global Jinja variable MUSE_VERSION, which despite its name is musehub.protocol.version.MUSE_VERSION -- musehub's own package version (importlib.metadata.version("musehub")), completely independent of the actual muse CLI tarball install.sh serves (muse and musehub version independently; see docs/deploy.md). The correct source is install.py's _latest_published_muse_version(), which scans the real releases directory for the most recently published muse-*.tar.gz. """ from __future__ import annotations from unittest.mock import patch import pytest from httpx import AsyncClient class TestGettingStartedVersionDisplay: @pytest.mark.asyncio async def test_shows_latest_published_muse_version_not_musehub_app_version( self, client: AsyncClient ) -> None: from musehub.protocol.version import MUSE_VERSION with patch( "musehub.api.routes.musehub.ui_docs._latest_published_muse_version", return_value="9.9.9-fake-muse-cli-version", ): r = await client.get("/muse/getting-started") assert r.status_code == 200 assert "muse 9.9.9-fake-muse-cli-version" in r.text # The regression this fixes: musehub's own app version must not # leak into this specific example-output block. if MUSE_VERSION != "9.9.9-fake-muse-cli-version": assert f"muse {MUSE_VERSION}" not in r.text @pytest.mark.asyncio async def test_falls_back_cleanly_when_no_tarballs_published( self, client: AsyncClient ) -> None: """When no releases exist yet, the real function's own documented fallback (musehub's app version) still renders a valid page.""" r = await client.get("/muse/getting-started") assert r.status_code == 200 assert "muse --version" in r.text