Exemplo n.º 1
0
 def test_send_thank_you(self, mock_print, mock_donation, mock_name):
     mailroom4.send_thank_you(self.donors)
     self.assertTrue(("Hello", "World") in self.donors)
     self.assertEqual(self.donors[("Hello", "World")]["donations"], [50])
     mailroom4.send_thank_you(self.donors)
     self.assertEqual(self.donors[("Richard", "Doe")]["donations"],
                      [30, 60, 50])
    def test_send_thank_you(self, mock_print, mock_donation, mock_name):
        # First test is a new donor
        mailroom4.send_thank_you(self.donors)
        self.assertTrue(("Hello", "World") in self.donors)
        self.assertEqual(self.donors[("Hello", "World")]["donations"], [50])

        # Second test is an existing donor
        mailroom4.send_thank_you(self.donors)
        self.assertEqual(self.donors[("Richard", "Doe")]["donations"],
                         [30, 60, 50])
    def test_send_thank_you(self):
        """Test send_thank_you() fxn"""

        # Test output thank you string
        se = ['Bert', '1000']
        with mock.patch('builtins.input', side_effect=se):
            captured_print = redirect_stdout()
            mr.send_thank_you(self.db)
            reset_stdout()

            self.assertEqual(captured_print.getvalue(),
                             self.db.thank_you_fmt.format('Bert', 1000) + '\n')
Exemplo n.º 4
0
def test_send_thank_you():
    expected = 'Thank you name for your donation of $123.45. We appreciate your generous support of our club.\n'
    assert mailroom4.send_thank_you('name', 123.45) == expected
def test_thank_you(donor="Amy Klobuchar", amount=float(1000)):
    thank_you_test = send_thank_you(donor, amount)
    if donor in thank_you_test and str(amount) in thank_you_test:
        return True
def test_append_value3(donor="Marsha Wheeler", amount=float(1000)):
    send_thank_you(donor, amount)
    assert amount in donor_dict[donor]
def test_append_name3(donor="Amy Klobuchar", amount=float(1000)):
    send_thank_you(donor, amount)
    assert amount in donor_dict[donor]
def test_append_value2(donor="Mark Zuckerberg", amount=float(10000)):
    send_thank_you(donor, amount)
    assert amount in donor_dict[donor]
def test_donor_name2(donor="Mark Zuckerberg", amount=float(1000)):
    send_thank_you(donor, amount)
    assert donor in donor_dict
def test_append_value1(donor="Paul Allen", amount=float(500)):
    send_thank_you(donor, amount)
    assert amount in donor_dict[donor]
def test_donor_name1(donor="Paul Allen", amount=float(500)):
    send_thank_you(donor, amount)
    assert donor in donor_dict