mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
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:
committed by
Dave Page
parent
b6e8d195dc
commit
5c3c543d2e
@@ -12,4 +12,4 @@ from pgadmin.utils.route import BaseTestGenerator
|
||||
|
||||
class BrowserGenerateTestCase(BaseTestGenerator):
|
||||
def runTest(self):
|
||||
return
|
||||
return
|
||||
|
||||
@@ -11,7 +11,6 @@ import uuid
|
||||
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.test_setup import config_data
|
||||
from regression import test_utils as utils
|
||||
|
||||
|
||||
class ChangePasswordTestCase(BaseTestGenerator):
|
||||
@@ -80,14 +79,6 @@ class ChangePasswordTestCase(BaseTestGenerator):
|
||||
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
This function login the test account before running the logout
|
||||
test case
|
||||
"""
|
||||
|
||||
utils.login_tester_account(self.tester)
|
||||
|
||||
def runTest(self):
|
||||
"""This function will check change password functionality."""
|
||||
|
||||
@@ -104,7 +95,8 @@ class ChangePasswordTestCase(BaseTestGenerator):
|
||||
email=email, password=password), follow_redirects=True)
|
||||
|
||||
response = self.tester.get('/change', follow_redirects=True)
|
||||
self.assertIn('pgAdmin 4 Password Change', response.data.decode())
|
||||
self.assertIn('pgAdmin 4 Password Change', response.data.decode(
|
||||
'utf-8'))
|
||||
|
||||
response = self.tester.post('/change', data=dict(
|
||||
password=self.password,
|
||||
@@ -112,12 +104,3 @@ class ChangePasswordTestCase(BaseTestGenerator):
|
||||
new_password_confirm=self.new_password_confirm),
|
||||
follow_redirects=True)
|
||||
self.assertIn(self.respdata, response.data.decode('utf-8'))
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
This function logout the test client
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
utils.logout_tester_account(self.tester)
|
||||
|
||||
@@ -41,7 +41,7 @@ class LoginTestCase(BaseTestGenerator):
|
||||
respdata='Email not provided')),
|
||||
|
||||
# This test case validates empty email and password
|
||||
('Empty_Creadentials', dict(
|
||||
('Empty_Credentials', dict(
|
||||
email='', password='',
|
||||
respdata='Email not provided')),
|
||||
|
||||
@@ -53,14 +53,14 @@ class LoginTestCase(BaseTestGenerator):
|
||||
respdata='Specified user does not exist')),
|
||||
|
||||
# This test case validates invalid email and password
|
||||
('Invalid_Creadentials', dict(
|
||||
('Invalid_Credentials', dict(
|
||||
email=str(uuid.uuid4())[1:6] + '@xyz.com',
|
||||
password=str(uuid.uuid4())[4:8],
|
||||
respdata='Specified user does not exist')),
|
||||
|
||||
# This test case validates the valid/correct credentials and allow user
|
||||
# to login pgAdmin 4
|
||||
('Valid_Creadentials', dict(
|
||||
('Valid_Credentials', dict(
|
||||
email=(config_data['pgAdmin4_login_credentials']
|
||||
['test_login_username']),
|
||||
password=(config_data['pgAdmin4_login_credentials']
|
||||
@@ -71,7 +71,12 @@ class LoginTestCase(BaseTestGenerator):
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
"""
|
||||
We need to logout the test client as we are testing scenarios of
|
||||
logging in the client like invalid password, invalid emails,
|
||||
empty credentials etc.
|
||||
"""
|
||||
utils.logout_tester_account(self.tester)
|
||||
|
||||
def runTest(self):
|
||||
"""This function checks login functionality."""
|
||||
@@ -83,10 +88,7 @@ class LoginTestCase(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
|
||||
|
||||
:return: None
|
||||
We need to again login the test client as soon as test scenarios
|
||||
finishes.
|
||||
"""
|
||||
|
||||
utils.logout_tester_account(self.tester)
|
||||
utils.login_tester_account(self.tester)
|
||||
|
||||
@@ -25,15 +25,17 @@ class LogoutTest(BaseTestGenerator):
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
This function login the test account before running the logout
|
||||
test case
|
||||
"""
|
||||
|
||||
utils.login_tester_account(self.tester)
|
||||
pass
|
||||
|
||||
def runTest(self):
|
||||
"""This function checks the logout functionality."""
|
||||
|
||||
response = self.tester.get('/logout')
|
||||
self.assertIn(self.respdata, response.data.decode('utf8'))
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
We need to again login the test client as soon as test scenarios
|
||||
finishes.
|
||||
"""
|
||||
utils.login_tester_account(self.tester)
|
||||
|
||||
@@ -11,7 +11,7 @@ import uuid
|
||||
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.test_setup import config_data
|
||||
from regression import test_utils as utils
|
||||
from test_utils import login_tester_account, logout_tester_account
|
||||
|
||||
|
||||
class ResetPasswordTestCase(BaseTestGenerator):
|
||||
@@ -38,28 +38,18 @@ class ResetPasswordTestCase(BaseTestGenerator):
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
"""
|
||||
This function login the test account before running the logout
|
||||
test case
|
||||
"""
|
||||
|
||||
utils.login_tester_account(self.tester)
|
||||
logout_tester_account(self.tester)
|
||||
|
||||
def runTest(self):
|
||||
"""This function checks reset password functionality."""
|
||||
|
||||
response = self.tester.get('/reset')
|
||||
self.assertIn('Recover pgAdmin 4 Password', response.data.decode())
|
||||
self.assertIn('Recover pgAdmin 4 Password', response.data.decode(
|
||||
'utf-8'))
|
||||
response = self.tester.post(
|
||||
'/reset', data=dict(email=self.email),
|
||||
follow_redirects=True)
|
||||
self.assertIn(self.respdata, response.data.decode('utf-8'))
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
This function logout the test client
|
||||
|
||||
:return: None
|
||||
"""
|
||||
|
||||
utils.logout_tester_account(self.tester)
|
||||
login_tester_account(self.tester)
|
||||
|
||||
Reference in New Issue
Block a user