Fixed API test cases by making the connection id unique for ERD.

This commit is contained in:
Aditya Toshniwal 2021-02-04 16:14:55 +05:30 committed by Akshay Joshi
parent 9c7691c891
commit 181bec62ce
7 changed files with 22 additions and 8 deletions

View File

@ -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:

View File

@ -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)

View 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
@ -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'],
})

View File

@ -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"},

View 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
@ -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)

View 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
@ -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__)

View 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)