From 67bb8998f37b1d530090f674101a3388271bac78 Mon Sep 17 00:00:00 2001 From: clavedeluna Date: Tue, 17 Oct 2023 08:56:21 -0300 Subject: [PATCH] update unit test --- integration_tests/base_test.py | 2 +- tests/test_codemodder.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/integration_tests/base_test.py b/integration_tests/base_test.py index e3886e72b..4a2ddd53d 100644 --- a/integration_tests/base_test.py +++ b/integration_tests/base_test.py @@ -175,7 +175,7 @@ def _run_idempotency_chec(self, command): if pathlib.Path(self.output_path).exists(): with open(self.output_path, "r", encoding="utf-8") as f: codetf = json.load(f) - assert codetf["results"] == [] + assert codetf["results"][0]["changeset"] == [] with open(self.code_path, "r", encoding="utf-8") as f: still_new_code = f.read() diff --git a/tests/test_codemodder.py b/tests/test_codemodder.py index 137bd65c8..caa3ac441 100644 --- a/tests/test_codemodder.py +++ b/tests/test_codemodder.py @@ -90,10 +90,9 @@ def test_reporting(self, mock_reporting, dry_run): args_to_reporting = mock_reporting.call_args_list[0][0] assert len(args_to_reporting) == 4 _, _, _, results_by_codemod = args_to_reporting - # assert len(results_by_codemod) == 2 - for codemod_results in results_by_codemod: - assert len(codemod_results["changeset"]) > 0 + registry = load_registered_codemods() + assert len(results_by_codemod) == len(registry.codemods) @mock.patch("codemodder.codemods.base_codemod.semgrep_run") def test_no_codemods_to_run(self, mock_semgrep_run):