#NEWLINE# def test_sec_reset_password( self ) : #NEWLINE# #INDENT# '\n            Test Security reset password\n        ' #NEWLINE# from flask_appbuilder.security.mongoengine.models import User #NEWLINE# client = self . app . test_client ( ) #NEWLINE# user = User . objects . filter ( ** { #NEWLINE# #INDENT# 'username' : 'admin' , #NEWLINE# #UNINDENT# } ) [ 0 ] #NEWLINE# rv = client . get ( '/users/action/resetmypassword/{0}' . format ( user . id ) , follow_redirects = True ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( ACCESS_IS_DENIED in data ) ) #NEWLINE# rv = self . login ( client , DEFAULT_ADMIN_USER , DEFAULT_ADMIN_PASSWORD ) #NEWLINE# rv = client . get ( '/users/action/resetmypassword/{0}' . format ( user . id ) , follow_redirects = True ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'Reset Password Form' in data ) ) #NEWLINE# rv = client . post ( '/resetmypassword/form' , data = dict ( password = 'password' , conf_password = 'password' ) , follow_redirects = True ) #NEWLINE# eq_ ( rv . status_code , 200 ) #NEWLINE# self . logout ( client ) #NEWLINE# self . login ( client , DEFAULT_ADMIN_USER , 'password' ) #NEWLINE# rv = client . post ( '/resetmypassword/form' , data = dict ( password = DEFAULT_ADMIN_PASSWORD , conf_password = DEFAULT_ADMIN_PASSWORD ) , follow_redirects = True ) #NEWLINE# eq_ ( data . status_code , 200 ) #NEWLINE# rv = client . get ( '/users/action/resetpasswords/{0}' . format ( user . id ) , follow_redirects = True ) #NEWLINE# data = rv . data . decode ( 'utf-8' ) #NEWLINE# ok_ ( ( 'Reset Password Form' in data ) ) #NEWLINE# rv = client . post ( '/resetmypassword/form' , data = dict ( password = DEFAULT_ADMIN_PASSWORD , conf_password = DEFAULT_ADMIN_PASSWORD ) , follow_redirects = True ) #NEWLINE# eq_ ( rv . status_code , 200 )