#NEWLINE# def test_changepassword_password_dont_match( 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' : '12345687' , #NEWLINE# 'password2' : '12345678' , #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 ( response . status_code , 400 ) #NEWLINE# self . assertEqual ( json . loads ( response . content ) . get ( 'errors' ) . get ( 'password2' ) [ 0 ] , 'You must type the same password each time.' )