From 86a8b165abbefd62e78fd43edcd66c0d09649442 Mon Sep 17 00:00:00 2001 From: Ashesh Vashi Date: Wed, 6 May 2026 15:03:18 +0530 Subject: [PATCH] fix(test): mock does_utility_exist in maintenance accept-valid tests MaintenanceInputValidationAcceptsValidTest asserted batch_process_mock was called, but the route short-circuits with success=0 (HTTP 200) when does_utility_exist() returns a missing-binary error. On Windows CI psql.exe is not at the path pgAdmin probes, so BatchProcess was never reached and the five 'accepted' scenarios failed with 'AssertionError: False is not true'. Stub does_utility_exist to None in this test so it focuses on input-validation acceptance, not on the runtime PostgreSQL binary layout. --- .../tests/test_maintenance_input_validation.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/web/pgadmin/tools/maintenance/tests/test_maintenance_input_validation.py b/web/pgadmin/tools/maintenance/tests/test_maintenance_input_validation.py index 3804068a9..4a1298168 100644 --- a/web/pgadmin/tools/maintenance/tests/test_maintenance_input_validation.py +++ b/web/pgadmin/tools/maintenance/tests/test_maintenance_input_validation.py @@ -186,13 +186,19 @@ class MaintenanceInputValidationAcceptsValidTest(BaseTestGenerator): vacuum_parallel='1024', verbose=True))), ] + @patch('pgadmin.tools.maintenance.does_utility_exist') @patch('pgadmin.tools.maintenance.Server') @patch('pgadmin.tools.maintenance.Message') @patch('pgadmin.tools.maintenance.BatchProcess') @patch('pgadmin.utils.driver.{0}.server_manager.ServerManager.' 'export_password_env'.format(PG_DEFAULT_DRIVER)) def runTest(self, export_password_env_mock, batch_process_mock, - message_mock, server_mock): + message_mock, server_mock, does_utility_exist_mock): + # The route short-circuits with success=0 when the psql binary + # is missing on disk; on Windows CI the binary is not at the + # path pgAdmin expects, so stub the check out to keep this test + # focused on input validation behavior. + does_utility_exist_mock.return_value = None self.server_id = parent_node_dict["database"][-1]["server_id"] self.db_id = parent_node_dict["database"][-1]["db_id"] url = MAINTENANCE_URL.format(self.server_id, self.db_id)