Rename horribly named function.

This commit is contained in:
Dave Page 2019-07-12 13:00:23 +01:00
parent ce8a2bb266
commit 3f4d5a687b
16 changed files with 39 additions and 39 deletions

View File

@ -19,7 +19,7 @@ from flask_babelex import gettext as _
from flask_security import login_required, current_user from flask_security import login_required, current_user
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc
from pgadmin.utils import PgAdminModule, get_storage_directory, html, \ 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 pgadmin.utils.ajax import make_json_response, bad_request
from config import PG_DEFAULT_DRIVER 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' \ utility = manager.utility('backup') if backup_obj_type == 'objects' \
else manager.utility('backup_server') else manager.utility('backup_server')
ret_val = is_utility_exists(utility) ret_val = does_utility_exist(utility)
if ret_val: if ret_val:
return make_json_response( return make_json_response(
success=0, success=0,
@ -512,7 +512,7 @@ def check_utility_exists(sid, backup_obj_type):
utility = manager.utility('backup') if backup_obj_type == 'objects' \ utility = manager.utility('backup') if backup_obj_type == 'objects' \
else manager.utility('backup_server') else manager.utility('backup_server')
ret_val = is_utility_exists(utility) ret_val = does_utility_exist(utility)
if ret_val: if ret_val:
return make_json_response( return make_json_response(
success=0, success=0,

View File

@ -14,7 +14,7 @@ import os
from pgadmin.utils.route import BaseTestGenerator from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict 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 \ from pgadmin.browser.server_groups.servers.databases.tests import utils as \
database_utils database_utils
@ -653,7 +653,7 @@ class BackupCreateJobTest(BaseTestGenerator):
binary_path = os.path.join( binary_path = os.path.join(
self.server['default_binary_paths'][self.server['type']], self.server['default_binary_paths'][self.server['type']],
'pg_dump') 'pg_dump')
retVal = is_utility_exists(binary_path) retVal = does_utility_exist(binary_path)
if retVal is not None: if retVal is not None:
self.skipTest(retVal) self.skipTest(retVal)

View File

@ -32,9 +32,9 @@ class TestUtilityCheckRouteCase(BaseTestGenerator):
def setUp(self): def setUp(self):
check_binary_path_or_skip_test(self, 'pg_dump') check_binary_path_or_skip_test(self, 'pg_dump')
@patch('pgadmin.tools.backup.is_utility_exists') @patch('pgadmin.tools.backup.does_utility_exist')
def runTest(self, is_utility_exists_mock): def runTest(self, does_utility_exist_mock):
is_utility_exists_mock.return_value = False does_utility_exist_mock.return_value = False
server_id = self.server_information['server_id'] server_id = self.server_information['server_id']
response = self.tester.get(self.url.format(server_id)) response = self.tester.get(self.url.format(server_id))
self.assertEquals(response.status_code, 200) self.assertEquals(response.status_code, 200)

View File

@ -11,7 +11,7 @@ import os
from pgadmin.utils.route import BaseTestGenerator from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict 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 import pgadmin.tools.backup.tests.test_backup_utils as backup_utils
@ -52,7 +52,7 @@ class BackupJobTest(BaseTestGenerator):
binary_path = os.path.join( binary_path = os.path.join(
self.server['default_binary_paths'][self.server['type']], self.server['default_binary_paths'][self.server['type']],
'pg_dump') 'pg_dump')
retVal = is_utility_exists(binary_path) retVal = does_utility_exist(binary_path)
if retVal is not None: if retVal is not None:
self.skipTest(retVal) self.skipTest(retVal)

View File

@ -17,7 +17,7 @@ from flask_babelex import gettext as _
from flask_security import login_required, current_user from flask_security import login_required, current_user
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc
from pgadmin.utils import PgAdminModule, get_storage_directory, html, \ 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 pgadmin.utils.ajax import make_json_response, bad_request
from config import PG_DEFAULT_DRIVER from config import PG_DEFAULT_DRIVER
@ -236,7 +236,7 @@ def create_import_export_job(sid):
# Get the utility path from the connection manager # Get the utility path from the connection manager
utility = manager.utility('sql') utility = manager.utility('sql')
ret_val = is_utility_exists(utility) ret_val = does_utility_exist(utility)
if ret_val: if ret_val:
return make_json_response( return make_json_response(
success=0, success=0,
@ -364,7 +364,7 @@ def check_utility_exists(sid):
manager = driver.connection_manager(server.id) manager = driver.connection_manager(server.id)
utility = manager.utility('sql') utility = manager.utility('sql')
ret_val = is_utility_exists(utility) ret_val = does_utility_exist(utility)
if ret_val: if ret_val:
return make_json_response( return make_json_response(
success=0, success=0,

View File

@ -32,9 +32,9 @@ class TestUtilityCheckRouteCase(BaseTestGenerator):
def setUp(self): def setUp(self):
check_binary_path_or_skip_test(self, 'psql') check_binary_path_or_skip_test(self, 'psql')
@patch('pgadmin.tools.import_export.is_utility_exists') @patch('pgadmin.tools.import_export.does_utility_exist')
def runTest(self, is_utility_exists_mock): def runTest(self, does_utility_exist_mock):
is_utility_exists_mock.return_value = False does_utility_exist_mock.return_value = False
server_id = self.server_information['server_id'] server_id = self.server_information['server_id']
response = self.tester.get(self.url.format(server_id)) response = self.tester.get(self.url.format(server_id))
self.assertEquals(response.status_code, 200) self.assertEquals(response.status_code, 200)

View File

@ -15,7 +15,7 @@ from flask import url_for, Response, render_template, request, current_app
from flask_babelex import gettext as _ from flask_babelex import gettext as _
from flask_security import login_required, current_user from flask_security import login_required, current_user
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc 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.ajax import bad_request, make_json_response
from pgadmin.utils.driver import get_driver from pgadmin.utils.driver import get_driver
@ -214,7 +214,7 @@ def create_maintenance_job(sid, did):
) )
utility = manager.utility('sql') utility = manager.utility('sql')
ret_val = is_utility_exists(utility) ret_val = does_utility_exist(utility)
if ret_val: if ret_val:
return make_json_response( return make_json_response(
success=0, success=0,
@ -298,7 +298,7 @@ def check_utility_exists(sid):
manager = driver.connection_manager(server.id) manager = driver.connection_manager(server.id)
utility = manager.utility('sql') utility = manager.utility('sql')
ret_val = is_utility_exists(utility) ret_val = does_utility_exist(utility)
if ret_val: if ret_val:
return make_json_response( return make_json_response(
success=0, success=0,

View File

@ -32,9 +32,9 @@ class TestUtilityCheckRouteCase(BaseTestGenerator):
def setUp(self): def setUp(self):
check_binary_path_or_skip_test(self, 'psql') check_binary_path_or_skip_test(self, 'psql')
@patch('pgadmin.tools.maintenance.is_utility_exists') @patch('pgadmin.tools.maintenance.does_utility_exist')
def runTest(self, is_utility_exists_mock): def runTest(self, does_utility_exist_mock):
is_utility_exists_mock.return_value = False does_utility_exist_mock.return_value = False
server_id = self.server_information['server_id'] server_id = self.server_information['server_id']
response = self.tester.get(self.url.format(server_id)) response = self.tester.get(self.url.format(server_id))
self.assertEquals(response.status_code, 200) self.assertEquals(response.status_code, 200)

View File

@ -14,7 +14,7 @@ import os
from pgadmin.utils.route import BaseTestGenerator from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict from regression import parent_node_dict
from pgadmin.utils import is_utility_exists from pgadmin.utils import does_utility_exist
class MaintenanceJobTest(BaseTestGenerator): class MaintenanceJobTest(BaseTestGenerator):
@ -52,7 +52,7 @@ class MaintenanceJobTest(BaseTestGenerator):
binary_path = os.path.join( binary_path = os.path.join(
self.server['default_binary_paths'][self.server['type']], 'psql') 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: if retVal is not None:
self.skipTest(retVal) self.skipTest(retVal)

View File

@ -13,7 +13,7 @@ import simplejson as json
from pgadmin.utils.route import BaseTestGenerator from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict 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 \ from pgadmin.browser.server_groups.servers.databases.tests import utils as \
database_utils database_utils
@ -141,7 +141,7 @@ class MaintenanceCreateJobTest(BaseTestGenerator):
binary_path = os.path.join( binary_path = os.path.join(
self.server['default_binary_paths'][self.server['type']], 'psql') 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: if retVal is not None:
self.skipTest(retVal) self.skipTest(retVal)

View File

@ -18,7 +18,7 @@ from flask_babelex import gettext as _
from flask_security import login_required, current_user from flask_security import login_required, current_user
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc
from pgadmin.utils import PgAdminModule, get_storage_directory, html, \ 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 pgadmin.utils.ajax import make_json_response, bad_request
from config import PG_DEFAULT_DRIVER from config import PG_DEFAULT_DRIVER
@ -232,7 +232,7 @@ def create_restore_job(sid):
) )
utility = manager.utility('restore') utility = manager.utility('restore')
ret_val = is_utility_exists(utility) ret_val = does_utility_exist(utility)
if ret_val: if ret_val:
return make_json_response( return make_json_response(
success=0, success=0,
@ -400,7 +400,7 @@ def check_utility_exists(sid):
manager = driver.connection_manager(server.id) manager = driver.connection_manager(server.id)
utility = manager.utility('restore') utility = manager.utility('restore')
ret_val = is_utility_exists(utility) ret_val = does_utility_exist(utility)
if ret_val: if ret_val:
return make_json_response( return make_json_response(
success=0, success=0,

View File

@ -32,9 +32,9 @@ class TestUtilityCheckRouteCase(BaseTestGenerator):
def setUp(self): def setUp(self):
check_binary_path_or_skip_test(self, 'pg_restore') check_binary_path_or_skip_test(self, 'pg_restore')
@patch('pgadmin.tools.restore.is_utility_exists') @patch('pgadmin.tools.restore.does_utility_exist')
def runTest(self, is_utility_exists_mock): def runTest(self, does_utility_exist_mock):
is_utility_exists_mock.return_value = False does_utility_exist_mock.return_value = False
server_id = self.server_information['server_id'] server_id = self.server_information['server_id']
response = self.tester.get(self.url.format(server_id)) response = self.tester.get(self.url.format(server_id))
self.assertEquals(response.status_code, 200) self.assertEquals(response.status_code, 200)

View File

@ -17,7 +17,7 @@ import simplejson as json
from pgadmin.utils.route import BaseTestGenerator from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils 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 import pgadmin.tools.backup.tests.test_backup_utils as backup_utils
@ -75,7 +75,7 @@ class RestoreJobTest(BaseTestGenerator):
binary_path = os.path.join( binary_path = os.path.join(
self.server['default_binary_paths'][self.server['type']], self.server['default_binary_paths'][self.server['type']],
'pg_restore') 'pg_restore')
retVal = is_utility_exists(binary_path) retVal = does_utility_exist(binary_path)
if retVal is not None: if retVal is not None:
self.skipTest(retVal) self.skipTest(retVal)

View File

@ -13,7 +13,7 @@ import os
from pgadmin.utils.route import BaseTestGenerator from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict 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 \ from pgadmin.browser.server_groups.servers.databases.tests import utils as \
database_utils database_utils
@ -305,7 +305,7 @@ class RestoreCreateJobTest(BaseTestGenerator):
binary_path = os.path.join( binary_path = os.path.join(
self.server['default_binary_paths'][self.server['type']], self.server['default_binary_paths'][self.server['type']],
'pg_restore') 'pg_restore')
retVal = is_utility_exists(binary_path) retVal = does_utility_exist(binary_path)
if retVal is not None: if retVal is not None:
self.skipTest(retVal) self.skipTest(retVal)

View File

@ -287,7 +287,7 @@ def get_complete_file_path(file):
return file if os.path.isfile(file) else None 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. This function will check the utility file exists on given path.
:return: :return:

View File

@ -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( binary_path = os.path.join(
cls.server['default_binary_paths'][cls.server['type']], cls.server['default_binary_paths'][cls.server['type']],
utility_name utility_name
) )
retVal = is_utility_exists(binary_path) retVal = does_utility_exist(binary_path)
if retVal is not None: if retVal is not None:
cls.skipTest(retVal) cls.skipTest(retVal)