Exemple #1
0
def test_output_donor_data():
    my_participant = Participant(fake_participant_conf)
    my_participant._donation_list = ["a donor", "another_donor"]
    my_participant._top_donor = "a top donor"
    my_participant.output_donor_data()
    assert fake_participant._format_donor_information_for_output.called
    assert fake_participant.write_text_files.called
Exemple #2
0
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"
Exemple #3
0
def test_get_top_donor_no_json():
    """Make sure the top donor works correctly if the JSON was not returned."""
    my_participant = Participant(fake_participant_conf)
    my_participant._top_donor = donor1
    my_participant.update_donor_data()
    assert my_participant._top_donor == donor1