Harden M8 trust and guidance workflows
This commit is contained in:
@@ -541,6 +541,37 @@ class TestRegistryPublishDryRun:
|
||||
assert _cmd_registry_publish(self.args(tool_dir)) == 1
|
||||
assert "YAML mapping" in capsys.readouterr().err
|
||||
|
||||
def test_normal_publish_runs_remote_preflight_before_mutation(
|
||||
self, tool_dir, monkeypatch
|
||||
):
|
||||
from cmdforge.cli.registry_commands import _cmd_registry_publish
|
||||
|
||||
client = MagicMock()
|
||||
client.get_me.return_value = {"slug": "testuser"}
|
||||
client.get_my_tool_status.return_value = {"status": "pending"}
|
||||
client.publish_tool.side_effect = [
|
||||
{
|
||||
"preflight": {"errors": [], "warnings": [], "suggestions": []},
|
||||
"quality": {"score": 80, "evidence_coverage": 60, "categories": []},
|
||||
},
|
||||
{
|
||||
"owner": "testuser", "name": "dry-run-tool",
|
||||
"version": "1.0.0", "status": "pending",
|
||||
},
|
||||
]
|
||||
monkeypatch.setattr(
|
||||
"cmdforge.cli.registry_commands.load_config",
|
||||
lambda: SimpleNamespace(registry=SimpleNamespace(token="token")),
|
||||
)
|
||||
monkeypatch.setattr("cmdforge.registry_client.get_client", lambda: client)
|
||||
args = SimpleNamespace(
|
||||
path=str(tool_dir), dry_run=False, force=True, owner=""
|
||||
)
|
||||
assert _cmd_registry_publish(args) == 0
|
||||
assert client.publish_tool.call_count == 2
|
||||
assert client.publish_tool.call_args_list[0].kwargs["dry_run"] is True
|
||||
assert "dry_run" not in client.publish_tool.call_args_list[1].kwargs
|
||||
|
||||
|
||||
def test_inspect_with_registry_uses_similarity_results(monkeypatch, capsys):
|
||||
from cmdforge.cli import cmd_inspect
|
||||
|
||||
Reference in New Issue
Block a user