Files
pgadmin4/web/pgadmin/browser/tests/test_reset_password.py
T

67 lines
2.2 KiB
Python
Raw Normal View History

2017-03-16 14:27:55 +00:00
##########################################################################
#
2017-03-16 14:27:55 +00:00
# pgAdmin 4 - PostgreSQL Tools
#
2021-01-04 15:34:45 +05:30
# Copyright (C) 2013 - 2021, The pgAdmin Development Team
2017-03-16 14:27:55 +00:00
# This software is released under the PostgreSQL Licence
#
2017-03-16 14:27:55 +00:00
##########################################################################
import uuid
from pgadmin.utils.route import BaseTestGenerator
from regression.python_test_utils.test_utils import login_tester_account
2016-07-18 14:50:21 +01:00
from regression.test_setup import config_data
2016-06-21 14:21:06 +01:00
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:8] + '@xyz.com',
2021-06-24 19:41:58 +05:30
respdata='Incorrect username or password')),
# This test case validates the valid email id
('TestCase for Validating Valid_Email', dict(
email=config_data['pgAdmin4_login_credentials']
2016-08-09 16:05:40 +01:00
['login_username'], respdata='pgAdmin 4'))
]
2016-08-09 16:05:40 +01:00
@classmethod
def setUpClass(cls):
cls.tester.logout()
2016-07-18 14:50:21 +01:00
2018-10-18 09:39:09 +01:00
# No need to call baseclass setup function
def setUp(self):
pass
def runTest(self):
"""This function checks reset password functionality."""
response = self.tester.get('/browser/reset_password')
self.assertTrue(
'Recover Password' in response.data.decode('utf-8')
)
self.assertTrue(
'Enter the email address for the user account you wish to '
'recover the password for' in response.data.decode('utf-8')
)
response = self.tester.post(
'/browser/reset_password', data=dict(email=self.email),
follow_redirects=True)
2016-10-07 13:59:43 +01:00
self.assertTrue(self.respdata in response.data.decode('utf-8'))
2016-07-18 14:50:21 +01:00
2016-08-09 16:05:40 +01:00
@classmethod
def tearDownClass(cls):
login_tester_account(cls.tester)