#NEWLINE# def test_validate_password_ok( self ) : #NEWLINE# #INDENT# user_service = pretend . stub ( find_userid = pretend . call_recorder ( ( lambda userid : 1 ) ) , check_password = pretend . call_recorder ( ( lambda userid , password : True ) ) ) #NEWLINE# form = forms . LoginForm ( data = { #NEWLINE# #INDENT# 'username' : 'my_username' , #NEWLINE# #UNINDENT# } , user_service = user_service ) #NEWLINE# field = pretend . stub ( data = 'pw' ) #NEWLINE# form . validate_password ( self ) #NEWLINE# assert ( user_service . find_userid . calls == [ pretend . call ( 'my_username' ) ] ) #NEWLINE# assert ( user_service . check_password . calls == [ pretend . call ( 1 , 'pw' ) ] )