#NEWLINE# def test_changepassword( self ) : #NEWLINE# #INDENT# user = UserFactory . create ( ** { #NEWLINE# #INDENT# 'password' : '123456' , #NEWLINE# #UNINDENT# } ) #NEWLINE# factory = APIRequestFactory ( ) #NEWLINE# url = reverse ( 'api:changepassword' ) #NEWLINE# data = { #NEWLINE# #INDENT# 'oldpassword' : '123456' , #NEWLINE# 'password1' : '1234567' , #NEWLINE# 'password2' : '1234567' , #NEWLINE# #UNINDENT# } #NEWLINE# request = factory . post ( url , json . dumps ( data ) , content_type = 'application/json' ) #NEWLINE# force_authenticate ( request , user = user ) #NEWLINE# view = ChangePasswordView . as_view ( ) #NEWLINE# response = view ( request ) . render ( ) #NEWLINE# self . assertEqual ( data . status_code , 204 )