Ensure that the dump servers functionality works from setup.py. Fixes #7644

This commit is contained in:
Akshay Joshi 2022-08-31 14:28:48 +05:30
parent e58b9c767b
commit 72f819ec67
5 changed files with 13 additions and 11 deletions

View File

@ -18,4 +18,5 @@ Housekeeping
Bug fixes
*********
| `Issue #7644 <https://redmine.postgresql.org/issues/7644>`_ - Ensure that the dump servers functionality works from setup.py.
| `Issue #7646 <https://redmine.postgresql.org/issues/7646>`_ - Ensure that the Import/Export server menu option is visible.

View File

@ -677,8 +677,8 @@ class Filemanager(object):
return files
@staticmethod
def check_access_permission(in_dir, path):
if not config.SERVER_MODE:
def check_access_permission(in_dir, path, skip_permission_check=False):
if not config.SERVER_MODE or skip_permission_check:
return
in_dir = '' if in_dir is None else in_dir

View File

@ -443,7 +443,8 @@ def dump_database_servers(output_file, selected_servers,
from pgadmin.misc.file_manager import Filemanager
try:
Filemanager.check_access_permission(storage_manager_path, file_path)
Filemanager.check_access_permission(storage_manager_path, file_path,
from_setup)
except Exception as e:
return _handle_error(str(e), from_setup)
@ -732,14 +733,14 @@ def _does_user_exist(user, from_setup):
if isinstance(user, User):
user = user.email
user = User.query.filter_by(email=user).first()
new_user = User.query.filter_by(email=user).first()
if user is None:
if new_user is None:
print(USER_NOT_FOUND % user)
if from_setup:
sys.exit(1)
return user
return new_user
def _handle_error(error_msg, from_setup):

View File

@ -150,7 +150,7 @@ describe('SearchObjects', ()=>{
};
it('search', (done)=>{
let ctrl = ctrlMount({});
let ctrl = ctrlMount();
setTimeout(()=>{
ctrl.update();
ctrl.find('InputText').find('input').simulate('change', {
@ -166,7 +166,7 @@ describe('SearchObjects', ()=>{
});
it('search_on_enter', (done)=>{
let ctrl = ctrlMount({});
let ctrl = ctrlMount();
setTimeout(()=>{
ctrl.update();
ctrl.find('InputText').find('input').simulate('change', {
@ -183,4 +183,4 @@ describe('SearchObjects', ()=>{
}, 0);
});
});
});
});

View File

@ -59,7 +59,7 @@ def dump_servers(args):
print('----------')
app = create_app(config.APP_NAME + '-cli')
with app.app_context():
with app.test_request_context():
dump_database_servers(args.dump_servers, args.servers, dump_user, True)
@ -84,7 +84,7 @@ def load_servers(args):
print('----------')
app = create_app(config.APP_NAME + '-cli')
with app.app_context():
with app.test_request_context():
load_database_servers(args.load_servers, None, load_user, True)