|
|
|
|
@@ -25,7 +25,9 @@ def test_analyst_comment_asks_approved_with_links(monkeypatch, tmp_path):
|
|
|
|
|
# 04b-ui-test-cases.md intentionally absent -> must NOT be linked
|
|
|
|
|
|
|
|
|
|
monkeypatch.setattr(SE, "get_worktree_path", lambda repo, branch: str(wt))
|
|
|
|
|
monkeypatch.setattr(SE.settings, "gitea_url", "https://git.mva154.duckdns.org")
|
|
|
|
|
# public URL set -> links must be built from it (not gitea_url)
|
|
|
|
|
monkeypatch.setattr(SE.settings, "gitea_url", "http://localhost:3000")
|
|
|
|
|
monkeypatch.setattr(SE.settings, "gitea_public_url", "https://git.mva154.duckdns.org")
|
|
|
|
|
monkeypatch.setattr(SE.settings, "gitea_owner", "admin")
|
|
|
|
|
|
|
|
|
|
html = SE._build_analyst_ready_comment(
|
|
|
|
|
@@ -45,3 +47,28 @@ def test_analyst_comment_asks_approved_with_links(monkeypatch, tmp_path):
|
|
|
|
|
assert base + "04-test-plan.yaml" in html
|
|
|
|
|
# the missing file is NOT invented
|
|
|
|
|
assert "04b-ui-test-cases.md" not in html
|
|
|
|
|
# internal git url must NOT appear in clickable links
|
|
|
|
|
assert "localhost:3000" not in html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_analyst_comment_falls_back_to_gitea_url(monkeypatch, tmp_path):
|
|
|
|
|
"""When gitea_public_url is empty, links fall back to gitea_url."""
|
|
|
|
|
from src import stage_engine as SE
|
|
|
|
|
|
|
|
|
|
wt = tmp_path / "wt"
|
|
|
|
|
docs = wt / "docs" / "work-items" / "ET-011"
|
|
|
|
|
docs.mkdir(parents=True)
|
|
|
|
|
(docs / "01-brd.md").write_text("x")
|
|
|
|
|
|
|
|
|
|
monkeypatch.setattr(SE, "get_worktree_path", lambda repo, branch: str(wt))
|
|
|
|
|
monkeypatch.setattr(SE.settings, "gitea_url", "http://localhost:3000")
|
|
|
|
|
monkeypatch.setattr(SE.settings, "gitea_public_url", "")
|
|
|
|
|
monkeypatch.setattr(SE.settings, "gitea_owner", "admin")
|
|
|
|
|
|
|
|
|
|
html = SE._build_analyst_ready_comment(
|
|
|
|
|
"enduro-trails", "ET-011", "feature/ET-011-gpx-upload-feature"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
base = ("http://localhost:3000/admin/enduro-trails/src/branch/"
|
|
|
|
|
"feature/ET-011-gpx-upload-feature/docs/work-items/ET-011/")
|
|
|
|
|
assert base + "01-brd.md" in html
|
|
|
|
|
|