mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Enhancements to the regression test suite.
Navnath Gadakh and Priyanka Shendge
This commit is contained in:
@@ -12,4 +12,4 @@ from pgadmin.utils.route import BaseTestGenerator
|
||||
|
||||
class BrowserGenerateTestCase(BaseTestGenerator):
|
||||
def runTest(self):
|
||||
print ("In BrowserGenerateTestCase...")
|
||||
return
|
||||
@@ -9,19 +9,18 @@
|
||||
|
||||
import uuid
|
||||
|
||||
from pgadmin.browser.tests.test_login import LoginTestCase
|
||||
from regression.config import config_data
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.test_setup import config_data
|
||||
from regression import test_utils as utils
|
||||
|
||||
|
||||
class ChangePasswordTestCase(LoginTestCase):
|
||||
class ChangePasswordTestCase(BaseTestGenerator):
|
||||
"""
|
||||
This class validates the change password functionality
|
||||
by defining change password scenarios; where dict of
|
||||
parameters describes the scenario appended by test name.
|
||||
"""
|
||||
|
||||
priority = 2
|
||||
|
||||
scenarios = [
|
||||
# This testcase validates invalid confirmation password
|
||||
('TestCase for Validating Incorrect_New_Password', dict(
|
||||
@@ -48,8 +47,7 @@ class ChangePasswordTestCase(LoginTestCase):
|
||||
new_password='', new_password_confirm='',
|
||||
respdata='Password not provided')),
|
||||
|
||||
# This testcase validates if current entered password
|
||||
# is incorrect
|
||||
# This testcase validates if current entered password is incorrect
|
||||
('TestCase for Validating Incorrect_Current_Password', dict(
|
||||
password=str(uuid.uuid4())[4:8],
|
||||
new_password=(config_data['pgAdmin4_login_credentials']
|
||||
@@ -70,6 +68,7 @@ class ChangePasswordTestCase(LoginTestCase):
|
||||
['test_new_password']),
|
||||
respdata='You successfully changed your password.')),
|
||||
('Reassigning_Password', dict(
|
||||
test_case='reassigning_password',
|
||||
password=(config_data['pgAdmin4_login_credentials']
|
||||
['test_new_password']),
|
||||
new_password=(config_data['pgAdmin4_login_credentials']
|
||||
@@ -81,14 +80,44 @@ class ChangePasswordTestCase(LoginTestCase):
|
||||
|
||||
]
|
||||
|
||||
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."""
|
||||
|
||||
# Check for 'test_case' exists in self For reassigning the password.
|
||||
# Password gets change in change password test case.
|
||||
if 'test_case' in dir(self):
|
||||
email = \
|
||||
config_data['pgAdmin4_login_credentials'][
|
||||
'test_login_username']
|
||||
password = \
|
||||
config_data['pgAdmin4_login_credentials'][
|
||||
'test_new_password']
|
||||
response = self.tester.post('/login', data=dict(
|
||||
email=email, password=password), follow_redirects=True)
|
||||
|
||||
response = self.tester.get('/change', follow_redirects=True)
|
||||
self.assertIn('pgAdmin 4 Password Change', response.data)
|
||||
self.assertIn('pgAdmin 4 Password Change', response.data.decode())
|
||||
|
||||
response = self.tester.post('/change', data=dict(
|
||||
password=self.password,
|
||||
new_password=self.new_password,
|
||||
new_password_confirm=self.new_password_confirm),
|
||||
follow_redirects=True)
|
||||
self.assertIn(self.respdata, response.data)
|
||||
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)
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
##########################################################################
|
||||
|
||||
import uuid
|
||||
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.config import config_data
|
||||
from regression.test_setup import config_data
|
||||
from regression import test_utils as utils
|
||||
|
||||
|
||||
class LoginTestCase(BaseTestGenerator):
|
||||
@@ -20,8 +20,6 @@ class LoginTestCase(BaseTestGenerator):
|
||||
describe the scenario appended by test name.
|
||||
"""
|
||||
|
||||
priority = 0
|
||||
|
||||
scenarios = [
|
||||
# This test case validates the invalid/incorrect password
|
||||
('TestCase for Checking Invalid_Password', dict(
|
||||
@@ -67,13 +65,28 @@ class LoginTestCase(BaseTestGenerator):
|
||||
['test_login_username']),
|
||||
password=(config_data['pgAdmin4_login_credentials']
|
||||
['test_login_password']),
|
||||
respdata='You are currently running version'))
|
||||
respdata='Gravatar image for %s' %
|
||||
config_data['pgAdmin4_login_credentials']
|
||||
['test_login_username']))
|
||||
]
|
||||
|
||||
def setUp(self):
|
||||
pass
|
||||
|
||||
def runTest(self):
|
||||
"""This function checks login functionality."""
|
||||
|
||||
response = self.tester.post('/login', data=dict(
|
||||
email=self.email, password=self.password),
|
||||
follow_redirects=True)
|
||||
self.assertIn(self.respdata, response.data)
|
||||
self.assertIn(self.respdata, response.data.decode('utf8'))
|
||||
|
||||
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
|
||||
"""
|
||||
|
||||
utils.logout_tester_account(self.tester)
|
||||
|
||||
@@ -7,38 +7,33 @@
|
||||
#
|
||||
# ##########################################################################
|
||||
|
||||
from pgadmin.browser.tests.test_login import LoginTestCase
|
||||
from regression.config import config_data
|
||||
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression import test_utils as utils
|
||||
|
||||
|
||||
class LogoutTest(LoginTestCase):
|
||||
class LogoutTest(BaseTestGenerator):
|
||||
"""
|
||||
This class verifies the logout functionality; provided the user is already
|
||||
logged-in. Dictionary parameters define the scenario appended by test
|
||||
name.
|
||||
"""
|
||||
|
||||
priority = 3
|
||||
|
||||
scenarios = [
|
||||
# This test case validate the logout page
|
||||
('Logging Out', dict(respdata='Redirecting...'))
|
||||
]
|
||||
|
||||
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 checks the logout functionality."""
|
||||
|
||||
response = self.tester.get('/logout')
|
||||
self.assertIn(self.respdata, response.data)
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
Defining tear down class, which will run after each test method execute.
|
||||
Re-logging in as further modules require login.
|
||||
"""
|
||||
|
||||
self.tester.post('/login', data=dict(
|
||||
email=(config_data['pgAdmin4_login_credentials']
|
||||
['test_login_username']),
|
||||
password=(config_data['pgAdmin4_login_credentials']
|
||||
['test_login_password'])), follow_redirects=True)
|
||||
self.assertIn(self.respdata, response.data.decode('utf8'))
|
||||
|
||||
@@ -10,7 +10,8 @@
|
||||
import uuid
|
||||
|
||||
from pgadmin.utils.route import BaseTestGenerator
|
||||
from regression.config import config_data
|
||||
from regression.test_setup import config_data
|
||||
from regression import test_utils as utils
|
||||
|
||||
|
||||
class ResetPasswordTestCase(BaseTestGenerator):
|
||||
@@ -19,7 +20,6 @@ class ResetPasswordTestCase(BaseTestGenerator):
|
||||
scenarios; Each dict parameter describe a scenario appended by
|
||||
test name.
|
||||
"""
|
||||
priority = 1
|
||||
|
||||
scenarios = [
|
||||
# This test case validates the empty email field
|
||||
@@ -37,12 +37,29 @@ class ResetPasswordTestCase(BaseTestGenerator):
|
||||
['test_login_username'], respdata='pgAdmin 4'))
|
||||
]
|
||||
|
||||
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 checks reset password functionality."""
|
||||
|
||||
response = self.tester.get('/reset')
|
||||
self.assertIn('Recover pgAdmin 4 Password', response.data)
|
||||
self.assertIn('Recover pgAdmin 4 Password', response.data.decode())
|
||||
response = self.tester.post(
|
||||
'/reset', data=dict(email=self.email),
|
||||
follow_redirects=True)
|
||||
self.assertIn(self.respdata, response.data)
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user