Skip to content

Commit 86a8b16

Browse files
committed
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.
1 parent bdbca57 commit 86a8b16

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

web/pgadmin/tools/maintenance/tests/test_maintenance_input_validation.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,19 @@ class MaintenanceInputValidationAcceptsValidTest(BaseTestGenerator):
186186
vacuum_parallel='1024', verbose=True))),
187187
]
188188

189+
@patch('pgadmin.tools.maintenance.does_utility_exist')
189190
@patch('pgadmin.tools.maintenance.Server')
190191
@patch('pgadmin.tools.maintenance.Message')
191192
@patch('pgadmin.tools.maintenance.BatchProcess')
192193
@patch('pgadmin.utils.driver.{0}.server_manager.ServerManager.'
193194
'export_password_env'.format(PG_DEFAULT_DRIVER))
194195
def runTest(self, export_password_env_mock, batch_process_mock,
195-
message_mock, server_mock):
196+
message_mock, server_mock, does_utility_exist_mock):
197+
# The route short-circuits with success=0 when the psql binary
198+
# is missing on disk; on Windows CI the binary is not at the
199+
# path pgAdmin expects, so stub the check out to keep this test
200+
# focused on input validation behavior.
201+
does_utility_exist_mock.return_value = None
196202
self.server_id = parent_node_dict["database"][-1]["server_id"]
197203
self.db_id = parent_node_dict["database"][-1]["db_id"]
198204
url = MAINTENANCE_URL.format(self.server_id, self.db_id)

0 commit comments

Comments
 (0)