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.
This commit is contained in:
Ashesh Vashi
2026-05-06 15:03:18 +05:30
parent bdbca57332
commit 86a8b165ab
@@ -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)