Пример #1
0
def test_output_donation_data_no_top_donation():
    """Test which functions are called if there is donation data to ouput."""
    my_participant = Participant(fake_participant_conf)
    my_participant._donation_list = ["a donor", "another_donor"]
    my_participant.output_donation_data()
    fake_participant._format_donation_information_for_output.assert_called()
    fake_participant.write_text_files.assert_called()
Пример #2
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
Пример #3
0
def test_format_donation_information_for_output():
    """Test donation output for the users."""
    my_participant = Participant(fake_participant_conf)
    donation1 = eldonationtracker.api.donation.Donation(donation1_json)
    donation2 = eldonationtracker.api.donation.Donation(donation2_json)
    donation3 = eldonationtracker.api.donation.Donation(
        donation_anonymous_json)
    my_participant._donation_list = [donation3, donation2, donation1]
    my_participant._top_donation = donation1
    my_participant._format_donation_information_for_output()
    assert my_participant._donation_formatted_output[
        'LastDonationNameAmnt'] == "Anonymous - $34.51"
    assert my_participant._donation_formatted_output['lastNDonationNameAmts'] == "Anonymous - $34.51\nDonor 2 - $34.51" \
                                                                                "\nDonor 1 - $34.51\n"
    assert my_participant._donation_formatted_output['lastNDonationNameAmtsMessage'] == "Anonymous - $34.51 - Good job" \
                                                                                       "! From Donor 3\nDonor 2 - $34" \
                                                                                       ".51 - None\nDonor 1 - $34.51" \
                                                                                       " - Good job! From Donor 1\n"
    assert my_participant._donation_formatted_output['lastNDonationNameAmtsMessageHorizontal'] == "Anonymous - $34.51" \
                                                                                                 " - Good job! From " \
                                                                                                 "Donor 3 | Donor 2 -" \
                                                                                                 " $34.51 - None | " \
                                                                                                 "Donor 1 - $34.51 - " \
                                                                                                 "Good job! From " \
                                                                                                 "Donor 1 | "
    assert my_participant._donation_formatted_output['lastNDonationNameAmtsHorizontal'] == "Anonymous - $34.51" \
                                                                                          " | Donor 2 - $34.51" \
                                                                                          " | Donor 1 - $34.51 | "