mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-24 15:26:46 -06:00
Fixed failed test cases.
This commit is contained in:
parent
737bc6a965
commit
c6f9d447f7
@ -60,7 +60,7 @@ export default class OneToManyDialog {
|
||||
},{
|
||||
id: 'referenced_table_uid', label: gettext('Referenced Table'),
|
||||
type: 'select2', disabled: false,
|
||||
editable: true, options: (view)=>{
|
||||
editable: true, options: ()=>{
|
||||
let retOpts = [];
|
||||
_.forEach(tableNodesDict, (node, uid)=>{
|
||||
let [schema, name] = node.getSchemaTableName();
|
||||
|
@ -17,6 +17,7 @@ from unittest.mock import patch, MagicMock
|
||||
|
||||
class BatchProcessTest(BaseTestGenerator):
|
||||
"""Test the BatchProcess class"""
|
||||
SERVER_NAME = "server (host:port)"
|
||||
scenarios = [
|
||||
('When maintained server',
|
||||
dict(
|
||||
@ -46,17 +47,20 @@ class BatchProcessTest(BaseTestGenerator):
|
||||
},
|
||||
cmd="VACUUM VERBOSE;\n"
|
||||
),
|
||||
expected_msg="Maintenance (Vacuum)",
|
||||
expected_msg="VACUUM (VERBOSE) on database "
|
||||
"'postgres' of server " + SERVER_NAME,
|
||||
expected_details_cmd='VACUUM VERBOSE;'
|
||||
))
|
||||
]
|
||||
|
||||
@patch('pgadmin.tools.maintenance.Message.get_server_name')
|
||||
@patch('pgadmin.misc.bgprocess.processes.Popen')
|
||||
@patch('pgadmin.misc.bgprocess.processes.db')
|
||||
@patch('pgadmin.tools.maintenance.Server')
|
||||
@patch('pgadmin.misc.bgprocess.processes.current_user')
|
||||
def runTest(self, current_user_mock, server_mock, db_mock,
|
||||
popen_mock):
|
||||
popen_mock, get_server_name_mock):
|
||||
get_server_name_mock.return_value = self.SERVER_NAME
|
||||
with self.app.app_context():
|
||||
current_user_mock.id = 1
|
||||
current_app.PGADMIN_RUNTIME = False
|
||||
|
@ -9,10 +9,13 @@
|
||||
|
||||
from pgadmin.tools.maintenance import Message
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class MaintenanceMessageTest(BaseTestGenerator):
|
||||
"""Test the Maintenance Message class"""
|
||||
|
||||
SERVER_NAME = "server (host:port)"
|
||||
scenarios = [
|
||||
('When maintained the server',
|
||||
dict(
|
||||
@ -28,7 +31,8 @@ class MaintenanceMessageTest(BaseTestGenerator):
|
||||
},
|
||||
cmd="VACUUM VERBOSE;\n"
|
||||
),
|
||||
expected_msg="Maintenance (Vacuum)",
|
||||
expected_msg="VACUUM (VERBOSE) on database "
|
||||
"'postgres' of server " + SERVER_NAME,
|
||||
expected_details_cmd='VACUUM VERBOSE;'
|
||||
|
||||
)),
|
||||
@ -46,7 +50,8 @@ class MaintenanceMessageTest(BaseTestGenerator):
|
||||
},
|
||||
cmd="VACUUM FULL VERBOSE;\n"
|
||||
),
|
||||
expected_msg="Maintenance (Vacuum)",
|
||||
expected_msg="VACUUM (FULL, VERBOSE) on database "
|
||||
"'postgres' of server " + SERVER_NAME,
|
||||
expected_details_cmd='VACUUM FULL VERBOSE;'
|
||||
|
||||
)),
|
||||
@ -64,7 +69,8 @@ class MaintenanceMessageTest(BaseTestGenerator):
|
||||
},
|
||||
cmd="ANALYZE VERBOSE;\n"
|
||||
),
|
||||
expected_msg="Maintenance (Analyze)",
|
||||
expected_msg="ANALYZE(VERBOSE) on database "
|
||||
"'postgres' of server " + SERVER_NAME,
|
||||
expected_details_cmd='ANALYZE VERBOSE;'
|
||||
|
||||
)),
|
||||
@ -82,7 +88,8 @@ class MaintenanceMessageTest(BaseTestGenerator):
|
||||
},
|
||||
cmd="REINDEX;\n"
|
||||
),
|
||||
expected_msg="Maintenance (Reindex)",
|
||||
expected_msg="REINDEX on database "
|
||||
"'postgres' of server " + SERVER_NAME,
|
||||
expected_details_cmd='REINDEX;'
|
||||
|
||||
)),
|
||||
@ -100,13 +107,16 @@ class MaintenanceMessageTest(BaseTestGenerator):
|
||||
},
|
||||
cmd="CLUSTER VERBOSE;\n"
|
||||
),
|
||||
expected_msg="Maintenance (Cluster)",
|
||||
expected_msg="CLUSTER on database "
|
||||
"'postgres' of server " + SERVER_NAME,
|
||||
expected_details_cmd='CLUSTER VERBOSE;'
|
||||
|
||||
)),
|
||||
]
|
||||
|
||||
def runTest(self):
|
||||
@patch('pgadmin.tools.maintenance.Message.get_server_name')
|
||||
def runTest(self, get_server_name_mock):
|
||||
get_server_name_mock.return_value = self.SERVER_NAME
|
||||
maintenance_obj = Message(
|
||||
self.class_params['sid'],
|
||||
self.class_params['data'],
|
||||
|
Loading…
Reference in New Issue
Block a user