2017-03-16 14:27:55 +00:00
|
|
|
##########################################################################
|
2016-04-17 10:39:08 -04:00
|
|
|
#
|
2017-03-16 14:27:55 +00:00
|
|
|
# pgAdmin 4 - PostgreSQL Tools
|
2016-04-17 10:39:08 -04:00
|
|
|
#
|
2018-01-05 10:42:49 +00:00
|
|
|
# Copyright (C) 2013 - 2018, The pgAdmin Development Team
|
2017-03-16 14:27:55 +00:00
|
|
|
# This software is released under the PostgreSQL Licence
|
2016-04-17 10:39:08 -04:00
|
|
|
#
|
2017-03-16 14:27:55 +00:00
|
|
|
##########################################################################
|
|
|
|
|
|
2016-04-17 10:39:08 -04:00
|
|
|
import uuid
|
|
|
|
|
|
|
|
|
|
from pgadmin.utils.route import BaseTestGenerator
|
2017-03-23 11:59:31 +00:00
|
|
|
from regression.python_test_utils.test_utils import login_tester_account
|
|
|
|
|
from regression.python_test_utils.test_utils import logout_tester_account
|
2016-07-18 14:50:21 +01:00
|
|
|
from regression.test_setup import config_data
|
2016-04-17 10:39:08 -04:00
|
|
|
|
2016-06-21 14:21:06 +01:00
|
|
|
|
2016-04-17 10:39:08 -04: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(
|
2017-11-27 12:01:50 +00:00
|
|
|
email=str(uuid.uuid4())[1:8] + '@xyz.com',
|
2016-04-17 10:39:08 -04:00
|
|
|
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']
|
2016-08-09 16:05:40 +01:00
|
|
|
['login_username'], respdata='pgAdmin 4'))
|
2016-04-17 10:39:08 -04:00
|
|
|
]
|
|
|
|
|
|
2016-08-09 16:05:40 +01:00
|
|
|
@classmethod
|
|
|
|
|
def setUpClass(cls):
|
|
|
|
|
logout_tester_account(cls.tester)
|
2016-07-18 14:50:21 +01:00
|
|
|
|
2016-04-17 10:39:08 -04:00
|
|
|
def runTest(self):
|
|
|
|
|
"""This function checks reset password functionality."""
|
|
|
|
|
|
2017-11-30 13:16:59 +00:00
|
|
|
response = self.tester.get('/browser/reset_password')
|
2016-10-07 13:59:43 +01:00
|
|
|
self.assertTrue('Recover pgAdmin 4 Password' in response.data.decode(
|
2016-07-27 15:33:36 +01:00
|
|
|
'utf-8'))
|
2016-04-17 10:39:08 -04:00
|
|
|
response = self.tester.post(
|
2017-11-30 13:16:59 +00:00
|
|
|
'/browser/reset_password', data=dict(email=self.email),
|
2016-04-17 10:39:08 -04:00
|
|
|
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)
|