mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-01-10 08:04:36 -06:00
Fixed API test cases by making the connection id unique for ERD.
This commit is contained in:
parent
9c7691c891
commit
181bec62ce
@ -561,6 +561,7 @@ def sql(trans_id, sgid, sid, did):
|
||||
@login_required
|
||||
def tables(trans_id, sgid, sid, did):
|
||||
helper = ERDHelper(trans_id, sid, did)
|
||||
conn = _get_connection(sid, did, trans_id)
|
||||
status, tables = helper.get_all_tables()
|
||||
|
||||
if not status:
|
||||
|
@ -8,6 +8,7 @@
|
||||
##########################################################################
|
||||
|
||||
import uuid
|
||||
import random
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.python_test_utils import test_utils as utils
|
||||
from regression import parent_node_dict
|
||||
@ -33,14 +34,15 @@ class ERDClose(BaseTestGenerator):
|
||||
if not db_con["info"] == "Database connected.":
|
||||
raise Exception("Could not connect to database to add the schema.")
|
||||
|
||||
trans_id = random.randint(1, 9999999)
|
||||
url = '/erd/initialize/{trans_id}/{sgid}/{sid}/{did}'.format(
|
||||
trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
trans_id=trans_id, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
|
||||
response = self.tester.post(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
url = '/erd/close/{trans_id}/{sgid}/{sid}/{did}'.format(
|
||||
trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
trans_id=trans_id, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
|
||||
response = self.tester.delete(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import json
|
||||
import uuid
|
||||
import random
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.python_test_utils import test_utils as utils
|
||||
from regression import parent_node_dict
|
||||
@ -34,14 +35,15 @@ class ERDInitialize(BaseTestGenerator):
|
||||
if not db_con["info"] == "Database connected.":
|
||||
raise Exception("Could not connect to database to add the schema.")
|
||||
|
||||
trans_id = random.randint(1, 9999999)
|
||||
url = '/erd/initialize/{trans_id}/{sgid}/{sid}/{did}'.format(
|
||||
trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
trans_id=trans_id, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
|
||||
response = self.tester.post(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
response_data = json.loads(response.data.decode('utf-8'))
|
||||
self.assertEqual(response_data['data'], {
|
||||
'connId': '123344',
|
||||
'connId': str(trans_id),
|
||||
'serverVersion': self.server_information['server_version'],
|
||||
})
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
##########################################################################
|
||||
|
||||
import uuid
|
||||
import random
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.python_test_utils import test_utils as utils
|
||||
from regression import parent_node_dict
|
||||
@ -25,9 +26,11 @@ class ERDPanel(BaseTestGenerator):
|
||||
self.sgid = config_data["server_group"]
|
||||
|
||||
def runTest(self):
|
||||
trans_id = random.randint(1, 9999999)
|
||||
url = '/erd/panel/{trans_id}?sgid={sgid}&sid={sid}&server_type=pg' \
|
||||
'&did={did}&gen=false'.\
|
||||
format(trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
format(trans_id=trans_id, sgid=self.sgid, sid=self.sid,
|
||||
did=self.did)
|
||||
|
||||
response = self.tester.post(
|
||||
url, data={"title": "panel_title", "close_url": "the/close/url"},
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import json
|
||||
import uuid
|
||||
import random
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.python_test_utils import test_utils as utils
|
||||
from regression import parent_node_dict
|
||||
@ -34,8 +35,9 @@ class ERDPrequisite(BaseTestGenerator):
|
||||
if not db_con["info"] == "Database connected.":
|
||||
raise Exception("Could not connect to database to add the schema.")
|
||||
|
||||
trans_id = random.randint(1, 9999999)
|
||||
url = '/erd/prequisite/{trans_id}/{sgid}/{sid}/{did}'.format(
|
||||
trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
trans_id=trans_id, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
|
||||
response = self.tester.get(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import json
|
||||
import uuid
|
||||
import random
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.python_test_utils import test_utils as utils
|
||||
from regression import parent_node_dict
|
||||
@ -62,8 +63,9 @@ class ERDSql(BaseTestGenerator):
|
||||
if not db_con["info"] == "Database connected.":
|
||||
raise Exception("Could not connect to database to add the schema.")
|
||||
|
||||
trans_id = random.randint(1, 9999999)
|
||||
url = '/erd/sql/{trans_id}/{sgid}/{sid}/{did}'.format(
|
||||
trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
trans_id=trans_id, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
|
||||
curr_dir = path.dirname(__file__)
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
import json
|
||||
import uuid
|
||||
import random
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.python_test_utils import test_utils as utils
|
||||
from regression import parent_node_dict
|
||||
@ -64,8 +65,9 @@ class ERDTables(BaseTestGenerator):
|
||||
if not db_con["info"] == "Database connected.":
|
||||
raise Exception("Could not connect to database to add the schema.")
|
||||
|
||||
trans_id = random.randint(1, 9999999)
|
||||
url = '/erd/tables/{trans_id}/{sgid}/{sid}/{did}'.format(
|
||||
trans_id=123344, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
trans_id=trans_id, sgid=self.sgid, sid=self.sid, did=self.did)
|
||||
|
||||
response = self.tester.get(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
Loading…
Reference in New Issue
Block a user