Fixed regression issue in taking backup of the table. Added some more test cases.

pull/35/head
Aditya Toshniwal 2020-08-25 18:06:38 +05:30 committed by Akshay Joshi
parent 59649ca42c
commit e582ffca38
2 changed files with 55 additions and 4 deletions

View File

@ -380,9 +380,9 @@ def _get_args_params_values(data, conn, backup_obj_type, backup_file, server,
args.extend(
functools.reduce(operator.iconcat, map(
lambda s, t: ['--table',
r'{0}'.format(driver.qtIdent(conn, s, t)
.replace('"', '\"'))],
lambda t: ['--table',
r'{0}'.format(driver.qtIdent(conn, t[0], t[1])
.replace('"', '\"'))],
data.get('tables', [])), []
)
)

View File

@ -405,7 +405,58 @@ class BackupCreateJobTest(BaseTestGenerator):
not_expected_cmd_opts=[],
expected_exit_code=[0, None]
)),
('When backup a schema with default options',
dict(
class_params=dict(
sid=1,
name='test_backup_server',
port=5444,
host='localhost',
database='postgres',
bfile='test_backup',
username='postgres'
),
params=dict(
file='test_backup_file',
format='custom',
verbose=True,
blobs=True,
schemas=['schema1'],
tables=[],
database='postgres'
),
url='/backup/job/{0}/object',
expected_cmd_opts=['--verbose', '--format=c', '--blobs',
'--schema', 'schema1'],
not_expected_cmd_opts=[],
expected_exit_code=[0, None]
)),
('When backup a table with default options',
dict(
class_params=dict(
sid=1,
name='test_backup_server',
port=5444,
host='localhost',
database='postgres',
bfile='test_backup',
username='postgres'
),
params=dict(
file='test_backup_file',
format='custom',
verbose=True,
blobs=True,
schemas=[],
tables=[['public', 'table1']],
database='postgres'
),
url='/backup/job/{0}/object',
expected_cmd_opts=['--verbose', '--format=c', '--blobs',
'--table', 'public.table1'],
not_expected_cmd_opts=[],
expected_exit_code=[0, None]
)),
('When backup the server',
dict(
class_params=dict(