From 3f4d5a687b95915892d925aa81a0f86a116be64c Mon Sep 17 00:00:00 2001 From: Dave Page Date: Fri, 12 Jul 2019 13:00:23 +0100 Subject: [PATCH] Rename horribly named function. --- web/pgadmin/tools/backup/__init__.py | 6 +++--- .../tools/backup/tests/test_backup_create_job_unit_test.py | 4 ++-- .../backup/tests/test_check_utility_exists_route_backup.py | 6 +++--- web/pgadmin/tools/backup/tests/test_create_backup_job.py | 4 ++-- web/pgadmin/tools/import_export/__init__.py | 6 +++--- .../tests/test_check_utility_exists_route_import_export.py | 6 +++--- web/pgadmin/tools/maintenance/__init__.py | 6 +++--- .../tests/test_check_utility_exists_route_maintenance.py | 6 +++--- .../tools/maintenance/tests/test_create_maintenance_job.py | 4 ++-- .../tests/test_maintenance_create_job_unit_test.py | 4 ++-- web/pgadmin/tools/restore/__init__.py | 6 +++--- .../tests/test_check_utility_exists_route_restore.py | 6 +++--- web/pgadmin/tools/restore/tests/test_create_restore_job.py | 4 ++-- .../restore/tests/test_restore_create_job_unit_test.py | 4 ++-- web/pgadmin/utils/__init__.py | 2 +- web/regression/python_test_utils/test_utils.py | 4 ++-- 16 files changed, 39 insertions(+), 39 deletions(-) diff --git a/web/pgadmin/tools/backup/__init__.py b/web/pgadmin/tools/backup/__init__.py index d9db93219..ac7b4ff32 100644 --- a/web/pgadmin/tools/backup/__init__.py +++ b/web/pgadmin/tools/backup/__init__.py @@ -19,7 +19,7 @@ from flask_babelex import gettext as _ from flask_security import login_required, current_user from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc from pgadmin.utils import PgAdminModule, get_storage_directory, html, \ - fs_short_path, document_dir, is_utility_exists + fs_short_path, document_dir, does_utility_exist from pgadmin.utils.ajax import make_json_response, bad_request from config import PG_DEFAULT_DRIVER @@ -331,7 +331,7 @@ def create_backup_objects_job(sid): utility = manager.utility('backup') if backup_obj_type == 'objects' \ else manager.utility('backup_server') - ret_val = is_utility_exists(utility) + ret_val = does_utility_exist(utility) if ret_val: return make_json_response( success=0, @@ -512,7 +512,7 @@ def check_utility_exists(sid, backup_obj_type): utility = manager.utility('backup') if backup_obj_type == 'objects' \ else manager.utility('backup_server') - ret_val = is_utility_exists(utility) + ret_val = does_utility_exist(utility) if ret_val: return make_json_response( success=0, diff --git a/web/pgadmin/tools/backup/tests/test_backup_create_job_unit_test.py b/web/pgadmin/tools/backup/tests/test_backup_create_job_unit_test.py index 5f930ea8c..693fde9ae 100644 --- a/web/pgadmin/tools/backup/tests/test_backup_create_job_unit_test.py +++ b/web/pgadmin/tools/backup/tests/test_backup_create_job_unit_test.py @@ -14,7 +14,7 @@ import os from pgadmin.utils.route import BaseTestGenerator from regression import parent_node_dict -from pgadmin.utils import server_utils as server_utils, is_utility_exists +from pgadmin.utils import server_utils as server_utils, does_utility_exist from pgadmin.browser.server_groups.servers.databases.tests import utils as \ database_utils @@ -653,7 +653,7 @@ class BackupCreateJobTest(BaseTestGenerator): binary_path = os.path.join( self.server['default_binary_paths'][self.server['type']], 'pg_dump') - retVal = is_utility_exists(binary_path) + retVal = does_utility_exist(binary_path) if retVal is not None: self.skipTest(retVal) diff --git a/web/pgadmin/tools/backup/tests/test_check_utility_exists_route_backup.py b/web/pgadmin/tools/backup/tests/test_check_utility_exists_route_backup.py index 2044684e5..51c1c6919 100644 --- a/web/pgadmin/tools/backup/tests/test_check_utility_exists_route_backup.py +++ b/web/pgadmin/tools/backup/tests/test_check_utility_exists_route_backup.py @@ -32,9 +32,9 @@ class TestUtilityCheckRouteCase(BaseTestGenerator): def setUp(self): check_binary_path_or_skip_test(self, 'pg_dump') - @patch('pgadmin.tools.backup.is_utility_exists') - def runTest(self, is_utility_exists_mock): - is_utility_exists_mock.return_value = False + @patch('pgadmin.tools.backup.does_utility_exist') + def runTest(self, does_utility_exist_mock): + does_utility_exist_mock.return_value = False server_id = self.server_information['server_id'] response = self.tester.get(self.url.format(server_id)) self.assertEquals(response.status_code, 200) diff --git a/web/pgadmin/tools/backup/tests/test_create_backup_job.py b/web/pgadmin/tools/backup/tests/test_create_backup_job.py index e21852dab..bc26a5a81 100644 --- a/web/pgadmin/tools/backup/tests/test_create_backup_job.py +++ b/web/pgadmin/tools/backup/tests/test_create_backup_job.py @@ -11,7 +11,7 @@ import os from pgadmin.utils.route import BaseTestGenerator from regression import parent_node_dict -from pgadmin.utils import is_utility_exists +from pgadmin.utils import does_utility_exist import pgadmin.tools.backup.tests.test_backup_utils as backup_utils @@ -52,7 +52,7 @@ class BackupJobTest(BaseTestGenerator): binary_path = os.path.join( self.server['default_binary_paths'][self.server['type']], 'pg_dump') - retVal = is_utility_exists(binary_path) + retVal = does_utility_exist(binary_path) if retVal is not None: self.skipTest(retVal) diff --git a/web/pgadmin/tools/import_export/__init__.py b/web/pgadmin/tools/import_export/__init__.py index 3ffec3a77..d116b6e4f 100644 --- a/web/pgadmin/tools/import_export/__init__.py +++ b/web/pgadmin/tools/import_export/__init__.py @@ -17,7 +17,7 @@ from flask_babelex import gettext as _ from flask_security import login_required, current_user from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc from pgadmin.utils import PgAdminModule, get_storage_directory, html, \ - fs_short_path, document_dir, IS_WIN, is_utility_exists + fs_short_path, document_dir, IS_WIN, does_utility_exist from pgadmin.utils.ajax import make_json_response, bad_request from config import PG_DEFAULT_DRIVER @@ -236,7 +236,7 @@ def create_import_export_job(sid): # Get the utility path from the connection manager utility = manager.utility('sql') - ret_val = is_utility_exists(utility) + ret_val = does_utility_exist(utility) if ret_val: return make_json_response( success=0, @@ -364,7 +364,7 @@ def check_utility_exists(sid): manager = driver.connection_manager(server.id) utility = manager.utility('sql') - ret_val = is_utility_exists(utility) + ret_val = does_utility_exist(utility) if ret_val: return make_json_response( success=0, diff --git a/web/pgadmin/tools/import_export/tests/test_check_utility_exists_route_import_export.py b/web/pgadmin/tools/import_export/tests/test_check_utility_exists_route_import_export.py index 9a55d1724..32422b2ca 100644 --- a/web/pgadmin/tools/import_export/tests/test_check_utility_exists_route_import_export.py +++ b/web/pgadmin/tools/import_export/tests/test_check_utility_exists_route_import_export.py @@ -32,9 +32,9 @@ class TestUtilityCheckRouteCase(BaseTestGenerator): def setUp(self): check_binary_path_or_skip_test(self, 'psql') - @patch('pgadmin.tools.import_export.is_utility_exists') - def runTest(self, is_utility_exists_mock): - is_utility_exists_mock.return_value = False + @patch('pgadmin.tools.import_export.does_utility_exist') + def runTest(self, does_utility_exist_mock): + does_utility_exist_mock.return_value = False server_id = self.server_information['server_id'] response = self.tester.get(self.url.format(server_id)) self.assertEquals(response.status_code, 200) diff --git a/web/pgadmin/tools/maintenance/__init__.py b/web/pgadmin/tools/maintenance/__init__.py index 5d362f9e5..84869b2fb 100644 --- a/web/pgadmin/tools/maintenance/__init__.py +++ b/web/pgadmin/tools/maintenance/__init__.py @@ -15,7 +15,7 @@ from flask import url_for, Response, render_template, request, current_app from flask_babelex import gettext as _ from flask_security import login_required, current_user from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc -from pgadmin.utils import PgAdminModule, html, is_utility_exists +from pgadmin.utils import PgAdminModule, html, does_utility_exist from pgadmin.utils.ajax import bad_request, make_json_response from pgadmin.utils.driver import get_driver @@ -214,7 +214,7 @@ def create_maintenance_job(sid, did): ) utility = manager.utility('sql') - ret_val = is_utility_exists(utility) + ret_val = does_utility_exist(utility) if ret_val: return make_json_response( success=0, @@ -298,7 +298,7 @@ def check_utility_exists(sid): manager = driver.connection_manager(server.id) utility = manager.utility('sql') - ret_val = is_utility_exists(utility) + ret_val = does_utility_exist(utility) if ret_val: return make_json_response( success=0, diff --git a/web/pgadmin/tools/maintenance/tests/test_check_utility_exists_route_maintenance.py b/web/pgadmin/tools/maintenance/tests/test_check_utility_exists_route_maintenance.py index 26fae04a2..a22ce9ade 100644 --- a/web/pgadmin/tools/maintenance/tests/test_check_utility_exists_route_maintenance.py +++ b/web/pgadmin/tools/maintenance/tests/test_check_utility_exists_route_maintenance.py @@ -32,9 +32,9 @@ class TestUtilityCheckRouteCase(BaseTestGenerator): def setUp(self): check_binary_path_or_skip_test(self, 'psql') - @patch('pgadmin.tools.maintenance.is_utility_exists') - def runTest(self, is_utility_exists_mock): - is_utility_exists_mock.return_value = False + @patch('pgadmin.tools.maintenance.does_utility_exist') + def runTest(self, does_utility_exist_mock): + does_utility_exist_mock.return_value = False server_id = self.server_information['server_id'] response = self.tester.get(self.url.format(server_id)) self.assertEquals(response.status_code, 200) diff --git a/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py b/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py index c78a3c6ac..23ac291b4 100644 --- a/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py +++ b/web/pgadmin/tools/maintenance/tests/test_create_maintenance_job.py @@ -14,7 +14,7 @@ import os from pgadmin.utils.route import BaseTestGenerator from regression import parent_node_dict -from pgadmin.utils import is_utility_exists +from pgadmin.utils import does_utility_exist class MaintenanceJobTest(BaseTestGenerator): @@ -52,7 +52,7 @@ class MaintenanceJobTest(BaseTestGenerator): binary_path = os.path.join( self.server['default_binary_paths'][self.server['type']], 'psql') - retVal = is_utility_exists(binary_path) + retVal = does_utility_exist(binary_path) if retVal is not None: self.skipTest(retVal) diff --git a/web/pgadmin/tools/maintenance/tests/test_maintenance_create_job_unit_test.py b/web/pgadmin/tools/maintenance/tests/test_maintenance_create_job_unit_test.py index 2a8d74fbd..9b60a38eb 100644 --- a/web/pgadmin/tools/maintenance/tests/test_maintenance_create_job_unit_test.py +++ b/web/pgadmin/tools/maintenance/tests/test_maintenance_create_job_unit_test.py @@ -13,7 +13,7 @@ import simplejson as json from pgadmin.utils.route import BaseTestGenerator from regression import parent_node_dict -from pgadmin.utils import server_utils as server_utils, is_utility_exists +from pgadmin.utils import server_utils as server_utils, does_utility_exist from pgadmin.browser.server_groups.servers.databases.tests import utils as \ database_utils @@ -141,7 +141,7 @@ class MaintenanceCreateJobTest(BaseTestGenerator): binary_path = os.path.join( self.server['default_binary_paths'][self.server['type']], 'psql') - retVal = is_utility_exists(binary_path) + retVal = does_utility_exist(binary_path) if retVal is not None: self.skipTest(retVal) diff --git a/web/pgadmin/tools/restore/__init__.py b/web/pgadmin/tools/restore/__init__.py index 40fc35088..5b646a8bc 100644 --- a/web/pgadmin/tools/restore/__init__.py +++ b/web/pgadmin/tools/restore/__init__.py @@ -18,7 +18,7 @@ from flask_babelex import gettext as _ from flask_security import login_required, current_user from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc from pgadmin.utils import PgAdminModule, get_storage_directory, html, \ - fs_short_path, document_dir, is_utility_exists + fs_short_path, document_dir, does_utility_exist from pgadmin.utils.ajax import make_json_response, bad_request from config import PG_DEFAULT_DRIVER @@ -232,7 +232,7 @@ def create_restore_job(sid): ) utility = manager.utility('restore') - ret_val = is_utility_exists(utility) + ret_val = does_utility_exist(utility) if ret_val: return make_json_response( success=0, @@ -400,7 +400,7 @@ def check_utility_exists(sid): manager = driver.connection_manager(server.id) utility = manager.utility('restore') - ret_val = is_utility_exists(utility) + ret_val = does_utility_exist(utility) if ret_val: return make_json_response( success=0, diff --git a/web/pgadmin/tools/restore/tests/test_check_utility_exists_route_restore.py b/web/pgadmin/tools/restore/tests/test_check_utility_exists_route_restore.py index 4c1b958c6..110f2eefa 100644 --- a/web/pgadmin/tools/restore/tests/test_check_utility_exists_route_restore.py +++ b/web/pgadmin/tools/restore/tests/test_check_utility_exists_route_restore.py @@ -32,9 +32,9 @@ class TestUtilityCheckRouteCase(BaseTestGenerator): def setUp(self): check_binary_path_or_skip_test(self, 'pg_restore') - @patch('pgadmin.tools.restore.is_utility_exists') - def runTest(self, is_utility_exists_mock): - is_utility_exists_mock.return_value = False + @patch('pgadmin.tools.restore.does_utility_exist') + def runTest(self, does_utility_exist_mock): + does_utility_exist_mock.return_value = False server_id = self.server_information['server_id'] response = self.tester.get(self.url.format(server_id)) self.assertEquals(response.status_code, 200) diff --git a/web/pgadmin/tools/restore/tests/test_create_restore_job.py b/web/pgadmin/tools/restore/tests/test_create_restore_job.py index 1a2c0ae07..4a3201e05 100644 --- a/web/pgadmin/tools/restore/tests/test_create_restore_job.py +++ b/web/pgadmin/tools/restore/tests/test_create_restore_job.py @@ -17,7 +17,7 @@ import simplejson as json from pgadmin.utils.route import BaseTestGenerator from regression import parent_node_dict from regression.python_test_utils import test_utils as utils -from pgadmin.utils import server_utils as server_utils, is_utility_exists +from pgadmin.utils import server_utils as server_utils, does_utility_exist import pgadmin.tools.backup.tests.test_backup_utils as backup_utils @@ -75,7 +75,7 @@ class RestoreJobTest(BaseTestGenerator): binary_path = os.path.join( self.server['default_binary_paths'][self.server['type']], 'pg_restore') - retVal = is_utility_exists(binary_path) + retVal = does_utility_exist(binary_path) if retVal is not None: self.skipTest(retVal) diff --git a/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py b/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py index 79c5d3b38..69e02dc1d 100644 --- a/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py +++ b/web/pgadmin/tools/restore/tests/test_restore_create_job_unit_test.py @@ -13,7 +13,7 @@ import os from pgadmin.utils.route import BaseTestGenerator from regression import parent_node_dict -from pgadmin.utils import server_utils as server_utils, is_utility_exists +from pgadmin.utils import server_utils as server_utils, does_utility_exist from pgadmin.browser.server_groups.servers.databases.tests import utils as \ database_utils @@ -305,7 +305,7 @@ class RestoreCreateJobTest(BaseTestGenerator): binary_path = os.path.join( self.server['default_binary_paths'][self.server['type']], 'pg_restore') - retVal = is_utility_exists(binary_path) + retVal = does_utility_exist(binary_path) if retVal is not None: self.skipTest(retVal) diff --git a/web/pgadmin/utils/__init__.py b/web/pgadmin/utils/__init__.py index cf92544ff..3ed4c7e0a 100644 --- a/web/pgadmin/utils/__init__.py +++ b/web/pgadmin/utils/__init__.py @@ -287,7 +287,7 @@ def get_complete_file_path(file): return file if os.path.isfile(file) else None -def is_utility_exists(file): +def does_utility_exist(file): """ This function will check the utility file exists on given path. :return: diff --git a/web/regression/python_test_utils/test_utils.py b/web/regression/python_test_utils/test_utils.py index 74afc10bf..4413705e5 100644 --- a/web/regression/python_test_utils/test_utils.py +++ b/web/regression/python_test_utils/test_utils.py @@ -1015,12 +1015,12 @@ def check_binary_path_or_skip_test(cls, utility_name): ) ) - from pgadmin.utils import is_utility_exists + from pgadmin.utils import does_utility_exist binary_path = os.path.join( cls.server['default_binary_paths'][cls.server['type']], utility_name ) - retVal = is_utility_exists(binary_path) + retVal = does_utility_exist(binary_path) if retVal is not None: cls.skipTest(retVal)