#NEWLINE# def test_validate_username_with_user( self ) : #NEWLINE# #INDENT# user_service = pretend . stub ( find_userid = pretend . call_recorder ( ( lambda userid : 1 ) ) ) #NEWLINE# form = forms . LoginForm ( user_service = user_service ) #NEWLINE# field = pretend . stub ( data = 'my_username' ) #NEWLINE# form . validate_username ( field ) #NEWLINE# assert ( field . find_userid . calls == [ pretend . call ( 'my_username' ) ] )