Test suite improvements:

- Test framework support API testing with multiple server for this we need to modify test_config.json(for user it’s test_config.json.in) and test_advanced_config.json(for user it’s test_advanced_config.json.in). Server details of PG and  PPAS are included in both .in files.

- Removed the logic of logging in  the test client on each test scenario(As per Khushboo's comment in previous email).  We need this logic in test cases under ‘browser/tests/’ as for test scenarios like change password and  invalid login test cases as test client should be logged out first. So, as per this the code is slightly modified in ‘browser/tests/’.
This commit is contained in:
Navnath Gadakh
2016-07-27 15:33:36 +01:00
committed by Dave Page
parent b6e8d195dc
commit 5c3c543d2e
21 changed files with 304 additions and 230 deletions

View File

@@ -8,11 +8,9 @@
# ##################################################################
import json
import uuid
from pgadmin.utils.route import BaseTestGenerator
from regression import test_utils as utils
from regression.test_setup import advanced_config_data
class DatabaseAddTestCase(BaseTestGenerator):
@@ -28,14 +26,11 @@ class DatabaseAddTestCase(BaseTestGenerator):
def setUp(self):
"""
This function perform the two tasks
1. Login to test client
2. Add the test server
This function used to add the sever
:return: None
"""
utils.login_tester_account(self.tester)
# Add the server
utils.add_server(self.tester)
@@ -45,8 +40,6 @@ class DatabaseAddTestCase(BaseTestGenerator):
server_connect_response, server_group, server_ids = \
utils.connect_server(self.tester)
# Store db id. Which is use to delete in tearDown()
self.db_id = ''
for server_connect, server_id in zip(server_connect_response,
server_ids):
if server_connect['data']['connected']:
@@ -58,17 +51,15 @@ class DatabaseAddTestCase(BaseTestGenerator):
self.assertTrue(db_response.status_code, 200)
response_data = json.loads(db_response.data.decode('utf-8'))
utils.write_db_parent_id(response_data)
self.db_id = response_data['node']['_id']
def tearDown(self):
"""
This function deletes the 'parent_id.pkl' file which is created in
setup() function. Also this function logout the test client
This function deletes the added database, added server and the
'parent_id.pkl' file which is created in setup()
:return: None
"""
utils.delete_database(self.tester, self.db_id)
utils.delete_database(self.tester)
utils.delete_server(self.tester)
utils.delete_parent_id_file()
utils.logout_tester_account(self.tester)

View File

@@ -12,7 +12,7 @@ import json
from pgadmin.utils.route import BaseTestGenerator
from regression import test_utils as utils
from regression.test_setup import config_data
from regression.test_utils import get_ids, test_getnodes
from regression.test_utils import get_ids
class DatabaseDeleteTestCase(BaseTestGenerator):
@@ -26,14 +26,12 @@ class DatabaseDeleteTestCase(BaseTestGenerator):
def setUp(self):
"""
This function perform the three tasks
1. Login to test client
2. Add the test server
3. Connect to server
1. Add the test server
2. Connect to server
:return: None
"""
utils.login_tester_account(self.tester)
# Firstly, add the server
utils.add_server(self.tester)
# Secondly, connect to server/database
@@ -45,14 +43,15 @@ class DatabaseDeleteTestCase(BaseTestGenerator):
srv_grp = config_data['test_server_group']
all_id = get_ids()
server_ids = all_id["sid"]
db_ids_dict = all_id["did"][0]
# TODO: Need to modify the code , to delete the databases for all
# TODO: servers. Currently it delete only one database.
db_id = all_id["did"][0]
db_con = test_getnodes(self.tester)
if len(db_con) == 0:
raise Exception("No database(s) to delete!!!")
for server_id in server_ids:
db_id = db_ids_dict[int(server_id)]
db_con = utils.verify_database(self.tester, srv_grp, server_id,
db_id)
if len(db_con) == 0:
raise Exception("No database(s) to delete for server id %s"
% server_id)
response = self.tester.delete(self.url + str(srv_grp) + '/' +
str(server_id) + '/' + str(db_id),
follow_redirects=True)
@@ -62,12 +61,11 @@ class DatabaseDeleteTestCase(BaseTestGenerator):
def tearDown(self):
"""
This function deletes the 'parent_id.pkl' file which is created in
setup() function. Also this function logout the test client
This function deletes the added server and the 'parent_id.pkl' file
which is created in setup() function.
:return: None
"""
utils.delete_server(self.tester)
utils.delete_parent_id_file()
utils.logout_tester_account(self.tester)

View File

@@ -10,7 +10,7 @@
from pgadmin.utils.route import BaseTestGenerator
from regression import test_utils as utils
from regression.test_setup import config_data
from regression.test_utils import get_ids, test_getnodes
from regression.test_utils import get_ids
class DatabasesGetTestCase(BaseTestGenerator):
@@ -26,14 +26,12 @@ class DatabasesGetTestCase(BaseTestGenerator):
def setUp(self):
"""
This function perform the three tasks
1. Login to test client
2. Add the test server
3. Connect to server
1. Add the test server
2. Connect to server
:return: None
"""
utils.login_tester_account(self.tester)
# Firstly, add the server
utils.add_server(self.tester)
# Secondly, connect to server/database
@@ -45,28 +43,27 @@ class DatabasesGetTestCase(BaseTestGenerator):
all_id = get_ids()
server_ids = all_id["sid"]
# TODO: Code is remaining to get all databases of all servers
self.db_id = all_id["did"][0]
db_ids_dict = all_id["did"][0]
srv_grp = config_data['test_server_group']
for server_id in server_ids:
db_con = test_getnodes(self.tester)
db_id = db_ids_dict[int(server_id)]
db_con = utils.verify_database(self.tester, srv_grp, server_id,
db_id)
if db_con["info"] == "Database connected.":
response = self.tester.get(self.url + str(srv_grp) + '/' +
str(server_id) + '/' + str(
self.db_id),
follow_redirects=True)
response = self.tester.get(
self.url + str(srv_grp) + '/' + str(server_id) + '/' +
str(db_id), follow_redirects=True)
self.assertEquals(response.status_code, 200)
def tearDown(self):
"""
This function deletes the 'parent_id.pkl' file which is created in
setup() function. Also this function logout the test client
This function deletes the added database, added server
and the 'parent_id.pkl' file which is created in setup() function.
:return: None
"""
utils.delete_database(self.tester, self.db_id)
utils.delete_database(self.tester)
utils.delete_server(self.tester)
utils.delete_parent_id_file()
utils.logout_tester_account(self.tester)

View File

@@ -12,7 +12,7 @@ import json
from pgadmin.utils.route import BaseTestGenerator
from regression import test_utils as utils
from regression.test_setup import config_data, advanced_config_data
from regression.test_utils import get_ids, test_getnodes
from regression.test_utils import get_ids
class DatabasesUpdateTestCase(BaseTestGenerator):
@@ -28,14 +28,12 @@ class DatabasesUpdateTestCase(BaseTestGenerator):
def setUp(self):
"""
This function perform the three tasks
1. Login to test client
2. Add the test server
3. Connect to server
1. Add the test server
2. Connect to server
:return: None
"""
utils.login_tester_account(self.tester)
# Firstly, add the server
utils.add_server(self.tester)
# Secondly, connect to server/database
@@ -47,33 +45,30 @@ class DatabasesUpdateTestCase(BaseTestGenerator):
srv_grp = config_data['test_server_group']
all_id = get_ids()
server_ids = all_id["sid"]
# TODO: Need to modify the code , to delete the databases for all
# TODO: servers. Currently it delete only one database.
db_id = all_id["did"][0]
test_getnodes(self.tester)
data = {
"comments": advanced_config_data["test_db_update_data"][0]
["test_comment"],
"id": db_id
}
db_ids_dict = all_id["did"][0]
for server_id in server_ids:
put_response = self.tester.put(self.url + str(srv_grp) + '/' +
str(server_id) + '/' + str(db_id),
data=json.dumps(data),
follow_redirects=True)
self.assertEquals(put_response.status_code, 200)
db_id = db_ids_dict[int(server_id)]
db_con = utils.verify_database(self.tester, srv_grp, server_id,
db_id)
if db_con["info"] == "Database connected.":
data = {
"comments": advanced_config_data["test_db_update_data"][0]
["test_comment"],
"id": db_id
}
put_response = self.tester.put(
self.url + str(srv_grp) + '/' + str(server_id) + '/' +
str(db_id), data=json.dumps(data), follow_redirects=True)
self.assertEquals(put_response.status_code, 200)
def tearDown(self):
"""
This function deletes the 'parent_id.pkl' file which is created in
setup() function. Also this function logout the test client
This function deletes the added server and 'parent_id.pkl' file
which is created in setup() function.
:return: None
"""
utils.delete_server(self.tester)
utils.delete_parent_id_file()
utils.logout_tester_account(self.tester)