mirror of
https://github.com/github/spec-kit.git
synced 2026-08-03 06:26:30 +08:00
fix(integrations): escape catalog metadata in discovery output (#3772)
* fix(integrations): escape catalog metadata in discovery output Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * fix(integrations): escape unknown query IDs Assisted-by: GitHub Copilot (model: GPT-5.6 Sol, autonomous) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1403,6 +1403,18 @@ class TestIntegrationCatalogDiscoveryCLI:
|
||||
"_install_allowed": True,
|
||||
},
|
||||
]
|
||||
MARKUP_INTEGRATION = {
|
||||
"id": "[red]markup-id[/red]",
|
||||
"name": "[green]Markup Name[/green]",
|
||||
"version": "[blue]1.0.0[/blue]",
|
||||
"description": "[yellow]Markup Description[/yellow]",
|
||||
"author": "[magenta]Markup Author[/magenta]",
|
||||
"license": "[cyan]Markup License[/cyan]",
|
||||
"repository": "[bold]Markup Repository[/bold]",
|
||||
"tags": ["[italic]markup-tag[/italic]"],
|
||||
"_catalog_name": "[underline]markup-catalog[/underline]",
|
||||
"_install_allowed": False,
|
||||
}
|
||||
|
||||
def _make_project(self, tmp_path):
|
||||
project = tmp_path / "proj"
|
||||
@@ -1866,6 +1878,25 @@ class TestIntegrationCatalogDiscoveryCLI:
|
||||
# acme-coder is flagged _install_allowed=False, so we should warn
|
||||
assert "Not directly installable" in result.output
|
||||
|
||||
def test_search_escapes_catalog_markup(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
self._patch_catalog(monkeypatch, integrations=[self.MARKUP_INTEGRATION])
|
||||
|
||||
result = self._invoke(["integration", "search"], project)
|
||||
|
||||
assert result.exit_code == 0, result.output
|
||||
output = _normalize_cli_output(result.output)
|
||||
for value in (
|
||||
self.MARKUP_INTEGRATION["id"],
|
||||
self.MARKUP_INTEGRATION["name"],
|
||||
self.MARKUP_INTEGRATION["version"],
|
||||
self.MARKUP_INTEGRATION["description"],
|
||||
self.MARKUP_INTEGRATION["author"],
|
||||
self.MARKUP_INTEGRATION["tags"][0],
|
||||
self.MARKUP_INTEGRATION["_catalog_name"],
|
||||
):
|
||||
assert value in output
|
||||
|
||||
# -- info --------------------------------------------------------------
|
||||
|
||||
def test_info_found(self, tmp_path, monkeypatch):
|
||||
@@ -1888,6 +1919,19 @@ class TestIntegrationCatalogDiscoveryCLI:
|
||||
assert result.exit_code == 1
|
||||
assert "not found" in result.output
|
||||
|
||||
def test_info_not_found_escapes_query_markup(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
self._patch_catalog(monkeypatch)
|
||||
integration_id = "[red]does-not-exist[/red]"
|
||||
|
||||
result = self._invoke(
|
||||
["integration", "info", integration_id],
|
||||
project,
|
||||
)
|
||||
|
||||
assert result.exit_code == 1
|
||||
assert integration_id in _normalize_cli_output(result.output)
|
||||
|
||||
def test_info_builtin_not_in_catalog(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
# Empty catalog, but copilot is a registered built-in.
|
||||
@@ -1896,6 +1940,30 @@ class TestIntegrationCatalogDiscoveryCLI:
|
||||
assert result.exit_code == 0, result.output
|
||||
assert "Built-in integration" in result.output
|
||||
|
||||
def test_info_escapes_catalog_markup(self, tmp_path, monkeypatch):
|
||||
project = self._make_project(tmp_path)
|
||||
self._patch_catalog(monkeypatch, integrations=[self.MARKUP_INTEGRATION])
|
||||
|
||||
result = self._invoke(
|
||||
["integration", "info", self.MARKUP_INTEGRATION["id"]],
|
||||
project,
|
||||
)
|
||||
|
||||
assert result.exit_code == 0, result.output
|
||||
output = _normalize_cli_output(result.output)
|
||||
for value in (
|
||||
self.MARKUP_INTEGRATION["id"],
|
||||
self.MARKUP_INTEGRATION["name"],
|
||||
self.MARKUP_INTEGRATION["version"],
|
||||
self.MARKUP_INTEGRATION["description"],
|
||||
self.MARKUP_INTEGRATION["author"],
|
||||
self.MARKUP_INTEGRATION["license"],
|
||||
self.MARKUP_INTEGRATION["repository"],
|
||||
self.MARKUP_INTEGRATION["tags"][0],
|
||||
self.MARKUP_INTEGRATION["_catalog_name"],
|
||||
):
|
||||
assert value in output
|
||||
|
||||
# -- validation vs network guidance ------------------------------------
|
||||
|
||||
def test_search_local_config_error_shows_local_config_tip(
|
||||
|
||||
Reference in New Issue
Block a user