pgadmin4/web/pgadmin/browser/tests/test_reset_password.py
Navnath Gadakh 81e2bc1e80 Test suite enhancements:
1. The user will specify the tablespace path in test_config.json.in
2.  If tablespace path not found, skip the test cases for that server(Only tablespace test cases)
3.  Add the skipped test summary in the test result. (Now it's showing on console + in log file, but need to update in a final enhanced test summary report. Which is research point we will work on that after finishing all nodes API test cases)
4.  Removed the test_ prefix from the values in the config files.
5. Add tablespace and roles tests
2016-08-09 16:05:40 +01:00

58 lines
1.9 KiB
Python

# ##########################################################################
#
# #pgAdmin 4 - PostgreSQL Tools
#
# #Copyright (C) 2013 - 2016, The pgAdmin Development Team
# #This software is released under the PostgreSQL Licence
#
# ##########################################################################
import uuid
from pgadmin.utils.route import BaseTestGenerator
from regression.test_setup import config_data
from test_utils import login_tester_account, logout_tester_account
class ResetPasswordTestCase(BaseTestGenerator):
"""
This class validates the reset password functionality by defining
scenarios; Each dict parameter describe a scenario appended by
test name.
"""
scenarios = [
# This test case validates the empty email field
('TestCase for Validating Empty Email', dict(
email='', respdata='Email not provided')),
# This test case validates the invalid/incorrect email field
('TestCase for Validating Invalid_Email', dict(
email=str(uuid.uuid4())[1:6] + '@xyz.com',
respdata='Specified user does not exist')),
# This test case validates the valid email id
('TestCase for Validating Valid_Email', dict(
email=config_data['pgAdmin4_login_credentials']
['login_username'], respdata='pgAdmin 4'))
]
@classmethod
def setUpClass(cls):
logout_tester_account(cls.tester)
def runTest(self):
"""This function checks reset password functionality."""
response = self.tester.get('/reset')
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'))
@classmethod
def tearDownClass(cls):
login_tester_account(cls.tester)