"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/
Python
fix: address 7 third-round Copilot review comments
fabio.mantelmacher05eae688be05
diff --git a/wiremock/agent-harness/cli_anything/wiremock/core/stubs.py b/wiremock/agent-harness/cli_anything/wiremock/core/stubs.pyindex 79249e7de..37e91c6e0 100644--- a/wiremock/agent-harness/cli_anything/wiremock/core/stubs.py+++ b/wiremock/agent-harness/cli_anything/wiremock/core/stubs.py@@ -63,7 +63,7 @@ class StubsManager:) -> dict:"""Helper: create a simple stub quickly."""response = {"status": status}- if body:+ if body is not None:response["body"] = bodyresponse["headers"] = {"Content-Type": content_type}mapping = {diff --git a/wiremock/agent-harness/cli_anything/wiremock/tests/test_full_e2e.py b/wiremock/agent-harness/cli_anything/wiremock/tests/test_full_e2e.pyindex 78a854573..c612f4ec7 100644--- a/wiremock/agent-harness/cli_anything/wiremock/tests/test_full_e2e.py+++ b/wiremock/agent-harness/cli_anything/wiremock/tests/test_full_e2e.py@@ -7,6 +7,7 @@ Tests for --help and argument parsing work without a server."""import jsonimport os+import shutilimport subprocessimport sysimport unittest@@ -25,9 +26,9 @@ def _resolve_cli(name: str) -> list:"""if os.environ.get(CLI_ENV_KEY):return [name]- result = subprocess.run(["which", name], capture_output=True, text=True)- if result.returncode == 0:- return [result.stdout.strip()]+ found = shutil.which(name)+ if found:+ return [found]# Fall back to running the module directlyreturn [sys.executable, "-m", "cli_anything.wiremock.wiremock_cli"]@@ -243,8 +244,8 @@ class TestLiveServer(unittest.TestCase):"--body", '{"hello":"world"}')self.assertEqual(result.returncode, 0)created = json.loads(result.stdout)- self.assertEqual(created["status"], "ok")- stub_id = created["data"]["id"]+ self.assertIn("id", created)+ stub_id = created["id"]self.assertIsNotNone(stub_id)# List and find it@@ -264,13 +265,13 @@ class TestLiveServer(unittest.TestCase):result = _run("--json", "stub", "create", json.dumps(mapping))self.assertEqual(result.returncode, 0)data = json.loads(result.stdout)- self.assertEqual(data["status"], "ok")+ self.assertIn("id", data)@skip_no_serverdef test_stub_get(self):# Create a stub firstr = _run("--json", "stub", "quick", "GET", "/get-test", "200")- stub_id = json.loads(r.stdout)["data"]["id"]+ stub_id = json.loads(r.stdout)["id"]result = _run("--json", "stub", "get", stub_id)self.assertEqual(result.returncode, 0)@@ -281,7 +282,7 @@ class TestLiveServer(unittest.TestCase):def test_stub_delete(self):# Create then deleter = _run("--json", "stub", "quick", "GET", "/delete-me", "200")- stub_id = json.loads(r.stdout)["data"]["id"]+ stub_id = json.loads(r.stdout)["id"]result = _run("--json", "stub", "delete", stub_id)self.assertEqual(result.returncode, 0)diff --git a/wiremock/agent-harness/cli_anything/wiremock/wiremock_cli.py b/wiremock/agent-harness/cli_anything/wiremock/wiremock_cli.pyindex e8aada179..034132fd0 100644--- a/wiremock/agent-harness/cli_anything/wiremock/wiremock_cli.py+++ b/wiremock/agent-harness/cli_anything/wiremock/wiremock_cli.py@@ -50,15 +50,15 @@ from cli_anything.wiremock.core.stubs import StubsManagerdef cli(ctx, host, port, scheme, user, password, json_mode):"""WireMock CLI — manage stubs, requests, scenarios, and recordings."""session = Session.from_env()- if host:+ if host is not None:session.host = host- if port:+ if port is not None:session.port = port- if scheme:+ if scheme is not None:session.scheme = scheme- if user:+ if user is not None:session.username = user- if password:+ if password is not None:session.password = passwordclient = WireMockClient(host=session.host,