#NEWLINE# @ mock . patch ( 'h.nipsa.models.NipsaUser' ) #NEWLINE# def test_remove_nipsa_schedules_task_if_user_exists( NipsaUser , worker ) : #NEWLINE# #INDENT# request = mock . Mock ( ) #NEWLINE# nipsa_user = mock . Mock ( ) #NEWLINE# nipsa_user . userid = 'test_id' #NEWLINE# NipsaUser . get_by_userid . return_value = nipsa_user #NEWLINE# logic . remove_nipsa ( request = request , userid = 'test_id' ) #NEWLINE# worker . remove_nipsa . delay . assert_called_once_with ( 'test_id' )