mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2024-11-29 20:13:50 -06:00
Fix regression tests for password reset in server mode
This commit is contained in:
parent
54389595da
commit
1a4e21e6dd
@ -769,7 +769,7 @@ if hasattr(config, 'SECURITY_RECOVERABLE') and config.SECURITY_RECOVERABLE:
|
|||||||
user=user, token=token)
|
user=user, token=token)
|
||||||
|
|
||||||
|
|
||||||
@blueprint.route("/forgot_password", endpoint="forgot_password",
|
@blueprint.route("/reset_password", endpoint="forgot_password",
|
||||||
methods=['GET', 'POST'])
|
methods=['GET', 'POST'])
|
||||||
@anonymous_user_required
|
@anonymous_user_required
|
||||||
def forgot_password():
|
def forgot_password():
|
||||||
@ -819,10 +819,10 @@ if hasattr(config, 'SECURITY_RECOVERABLE') and config.SECURITY_RECOVERABLE:
|
|||||||
|
|
||||||
|
|
||||||
# We are not in app context so cannot use url_for('browser.forgot_password')
|
# We are not in app context so cannot use url_for('browser.forgot_password')
|
||||||
# So hard code the url '/browser/forgot_password' while passing as
|
# So hard code the url '/browser/reset_password' while passing as
|
||||||
# parameter to slash_url_suffix function.
|
# parameter to slash_url_suffix function.
|
||||||
@blueprint.route('/forgot_password' + slash_url_suffix(
|
@blueprint.route('/reset_password' + slash_url_suffix(
|
||||||
'/browser/forgot_password', '<token>'),
|
'/browser/reset_password', '<token>'),
|
||||||
methods=['GET', 'POST'],
|
methods=['GET', 'POST'],
|
||||||
endpoint='reset_password')
|
endpoint='reset_password')
|
||||||
@anonymous_user_required
|
@anonymous_user_required
|
||||||
|
@ -45,11 +45,11 @@ class ResetPasswordTestCase(BaseTestGenerator):
|
|||||||
def runTest(self):
|
def runTest(self):
|
||||||
"""This function checks reset password functionality."""
|
"""This function checks reset password functionality."""
|
||||||
|
|
||||||
response = self.tester.get('/reset')
|
response = self.tester.get('/browser/reset_password')
|
||||||
self.assertTrue('Recover pgAdmin 4 Password' in response.data.decode(
|
self.assertTrue('Recover pgAdmin 4 Password' in response.data.decode(
|
||||||
'utf-8'))
|
'utf-8'))
|
||||||
response = self.tester.post(
|
response = self.tester.post(
|
||||||
'/reset', data=dict(email=self.email),
|
'/browser/reset_password', data=dict(email=self.email),
|
||||||
follow_redirects=True)
|
follow_redirects=True)
|
||||||
self.assertTrue(self.respdata in response.data.decode('utf-8'))
|
self.assertTrue(self.respdata in response.data.decode('utf-8'))
|
||||||
|
|
||||||
|
@ -8,11 +8,11 @@
|
|||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
def change_password(self):
|
def change_password(self):
|
||||||
response = self.tester.get('/change', follow_redirects=True)
|
response = self.tester.get('/browser/change_password', follow_redirects=True)
|
||||||
self.assertTrue('pgAdmin 4 Password Change' in response.data.decode(
|
self.assertTrue('pgAdmin 4 Password Change' in response.data.decode(
|
||||||
'utf-8'))
|
'utf-8'))
|
||||||
|
|
||||||
response = self.tester.post('/change', data=dict(
|
response = self.tester.post('/browser/change_password', data=dict(
|
||||||
password=self.password,
|
password=self.password,
|
||||||
new_password=self.new_password,
|
new_password=self.new_password,
|
||||||
new_password_confirm=self.new_password_confirm),
|
new_password_confirm=self.new_password_confirm),
|
||||||
|
@ -51,6 +51,12 @@ if sys.path[0] != root:
|
|||||||
|
|
||||||
from pgadmin import create_app
|
from pgadmin import create_app
|
||||||
import config
|
import config
|
||||||
|
|
||||||
|
if config.SERVER_MODE is True:
|
||||||
|
config.SECURITY_RECOVERABLE = True
|
||||||
|
config.SECURITY_CHANGEABLE = True
|
||||||
|
config.SECURITY_POST_CHANGE_VIEW = 'browser.change_password'
|
||||||
|
|
||||||
from regression import test_setup
|
from regression import test_setup
|
||||||
from regression.feature_utils.app_starter import AppStarter
|
from regression.feature_utils.app_starter import AppStarter
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user