def test_format_donor_information_for_output(): """Make sure the donor information is properly formatted for the users.""" my_participant = Participant(fake_participant_conf) my_participant._top_donor = donor1 my_participant._donor_list = [donor2, donor1] my_participant._format_donor_information_for_output() assert my_participant._top_donor_formatted_output[ 'TopDonorNameAmnt'] == "donor1 - $45.00" assert my_participant._donor_formatted_output[ 'LastDonorNameAmnt'] == "donor2 - $20.00" assert my_participant._donor_formatted_output[ 'lastNDonorNameAmts'] == "donor2 - $20.00\ndonor1 - $45.00\n"
def test_run_get_a_donation(): fake_participant_for_run.output_participant_data.reset_mock() fake_participant_for_run.update_donation_data.reset_mock() fake_participant_for_run.output_donation_data.reset_mock() fake_participant_for_run.update_donor_data.reset_mock() fake_participant_for_run.output_donor_data.reset_mock() fake_participant_for_run.my_team.team_run.reset_mock() fake_participant_for_run.my_team.participant_run.reset_mock() my_participant = Participant(fake_participant_conf) assert my_participant.number_of_donations == 0 my_participant._first_run = False # to simulate that this is after one run already my_participant._donor_list = ['this is fake mocked and does not matter'] my_participant.run() fake_participant_for_run.output_participant_data.assert_called_once() fake_participant_for_run.update_donation_data.assert_called_once() fake_participant_for_run.output_donation_data.assert_called_once() fake_participant_for_run.update_donor_data.assert_called_once() fake_participant_for_run.output_donor_data.assert_called_once() fake_participant_for_run.my_team.team_run.assert_called_once()