Example #1
0
 def test_add_donation_existing_donor(self):
     name = 'Roy'
     donation = 112233445566
     # add the new donor to the list
     donation_list = mailroom4.add_donation(name, donation)
     # Ensure the new donation was appended
     assert donation in donation_list[name]
Example #2
0
def test_1():
    assert "Albert Einstein" in getdb()  # pre_condition sanity test
    new_name = "aleksandr lyapunov"
    new_amount = 731
    res = add_donation(new_name, new_amount)
    assert res == "=== Thank You, Aleksandr Lyapunov, for the $731.00 donation! ==="  # resulting string is correctly generated
    assert "Aleksandr Lyapunov" in getdb()  # new entry name is in the database
    assert 731 in getdb()[
        "Aleksandr Lyapunov"]  # new amount is in the database
Example #3
0
 def test_add_donation_new_donor(self):
     name = 'BillyBobHexagon'
     donation = 7000
     # add the new donor to the list
     donation_list = mailroom4.add_donation(name, donation)
     # The list returned should contain our new donor
     assert 'BillyBobHexagon' in donation_list
     # Ensure the new donation was appended
     assert donation_list[name] == [donation]
def test_add_donation_1():
    # adds single donor and donation as expected
    mailroom4.donors = {
              "William Gates, III": [653772.32, 12.17],
              "Mark Zuckerberg": [1663.23, 4300.87, 10432.0],
              "Jeff Bezos": [877.33],
              "Paul Allen": [663.23, 43.87, 1.32]
    }
    donor_name = "The Dude"
    donation_amount = 100.00
    expected_dict = {
              "William Gates, III": [653772.32, 12.17],
              "Mark Zuckerberg": [1663.23, 4300.87, 10432.0],
              "Jeff Bezos": [877.33],
              "Paul Allen": [663.23, 43.87, 1.32],
              "The Dude": [100.0]
    }
    mailroom4.add_donation(donor_name, donation_amount)
    assert mailroom4.donors == expected_dict
    def test_add_donation(self):
        """
        Test the add_donation 
        """

        # test add new donor
        golden_donors_db = {
            'Lily Maycat': [5000],
            'Lulu Lemon': [5000, 5000],
            'Marc Jacobs': [5000, 5000, 5000],
            'Bobbi Brown': [5000, 5000, 5000, 5000],
            'Kate Spade': [5000, 5000, 5000, 5000, 5000],
            'Dragron Four': [300]  #new donor to test
        }

        mailroom4.add_donation("Dragron Four", 300)
        assert mailroom4.donors_db == golden_donors_db

        # test add the old name + gift
        golden_donors_db['Kate Spade'].append(300)
        mailroom4.add_donation('Kate Spade', 300)
        assert mailroom4.donors_db == golden_donors_db
def test_add_donation_2():
    # correctly adds donation if donor already in dict
    mailroom4.donors = {"William Gates, III": [653772.32, 12.17]}
    expected_dict = {"William Gates, III": [653772.32, 12.17, 100.0]}
    mailroom4.add_donation("William Gates, III", 100.00)
    assert mailroom4.donors == expected_dict
Example #7
0
def test_add_donation_existing_name():
    """Test that a donation is being added to the correct donor"""
    expected = {'Jim': [123.00, 123.23], 'Steve': [123.23]}
    assert mailroom.add_donation(name1, dict1, str(donation2)) == expected
def test_add_donation_oldName():
    mailroom4.add_donation("Charles Barkley", 12456)

    assert mailroom4.create_letter(
        "Charles Barkley"
    ) == 'Dear Charles Barkley,\n\tThank you for your donation of $12,456.00 to the foundation.\tWe also thank you for your continuing support and appreciate that you are a repeat giver.\tYour generous gift will make a tremendous difference in the coming years.\n\nSincerely,\n\tDirector of the Foundation\n'
Example #9
0
 def test_add_donation2(self):
     test_dons = deepcopy(dons)
     real = add_donation(test_dons, "John Doe", 1000)
     test_dons["John Doe"] = [1100, 2, 550]
     self.assertEqual(real, test_dons)
def test_add_donation():
    mailroom4.add_donor(user)
    mailroom4.add_donation(user, donation)
    assert donation in mailroom4.donors[user]
def test_add_donor():
    donors = {"Paul Allen": [175, 200], "Tim Cook": [200]}
    mailroom4.add_donation("Tim Cook", 75, donors)
    mailroom4.add_donation("Eric Grandeo", 50, donors)
    assert donors == donors2
def test_add_donation_2():                   #add donation of a new donor
    add_donation('Joe Smith', 370.28)
    summary = donors_summary()
    assert summary[6] == ('Joe Smith', 370.28, 1, 370.28)
def test_add_donation_1():                   #add donation to existing donor
    add_donation('Jennifer Lee', 150)
    summary = donors_summary()               #if donors_summary is passed, then it can be used for assert testing here
    assert summary[2] == ('Jennifer Lee', 1620.17, 3, 540.06)
Example #14
0
def test_add_donation():
    mailroom4.add_donation('Tim Cook', 500)
    assert mailroom4.donor_db['Tim Cook'] == [500]
Example #15
0
def test12():
    """Integration test of add_donation with correct inputs."""
    assert mailroom4.add_donation('han solo', '45') == True
Example #16
0
def test13():
    """Integration test of add_donation with name not in donors."""
    assert mailroom4.add_donation('new_name', '45') == True
Example #17
0
def test_existing_donation():
    mr4.add_donation("Alyssa Nhan", "Alyssa Nhan", 2.32)
    assert mr4.donor_dict["Alyssa Nhan"] == [23., 23, 2.32]
Example #18
0
def test_new_donation():
    mr4.add_donation(None, "Tom Asdf", 1324.23)
    assert mr4.donor_dict["Tom Asdf"] == [1324.23]
Example #19
0
def test_add_donation():
    """ Test add_donation function """
    add_donation('Jane Doe', 123.22)
    assert mailroom4.donors.get('Jane Doe')[-1] == 123.22
Example #20
0
 def test_add_donation1(self):
     test_dons = deepcopy(dons)
     real = add_donation(test_dons, "Ice T", 1000)
     test_dons["Ice T"] = [1000, 1, 1000]
     self.assertEqual(real, test_dons)
Example #21
0
def test_add_donation_new_name():
    """Test that a name and donation are being added correctly to the Donor List"""
    expected = {'Jim': [123.00], 'Steve': [123.23]}
    assert mailroom.add_donation(name2, dict1, str(donation2)) == expected
Example #22
0
 def test_add_donation3(self):
     test_dons = deepcopy(dons)
     real = add_donation(test_dons, "John Doe", 800, 2)
     test_dons["John Doe"] = [1800, 3, 600]
     self.assertEqual(real, test_dons)
def test_add_donation_newName():
    mailroom4.add_donation("New Person", 12456)

    assert mailroom4.create_letter(
        "New Person"
    ) == 'Dear New Person,\n\tThank you for your donation of $12,456.00 to the foundation.\tYour generous gift will make a tremendous difference in the coming years.\n\nSincerely,\n\tDirector of the Foundation\n'