예제 #1
0
    def test_saves_donation_on_post_with_minimal_information(self):
        donor_name = self.random_donor_name
        random_amount = self.random_amount
        data = self.get_base_random_data(name=donor_name, amount=random_amount)
        data.update(self.get_data_as_formset())

        # sanity check
        self.assertRaises(models.Donor.DoesNotExist,
                models.Donor.objects.get, name=donor_name)
        with override_settings(ARMSTRONG_DONATION_FORM="SimpleDonationForm"):
            self.client.post(self.url, data)
        donor = models.Donor.objects.get(name=donor_name)
        self.assertEqual(donor.name, donor_name)
        donation = models.Donation.objects.get(donor=donor)
        self.assertEqual(donation.amount, random_amount)
예제 #2
0
    def test_saves_donation_on_post_with_minimal_information(self):
        name_kwargs = self.random_donor_kwargs
        random_amount = self.random_amount
        data = self.get_base_random_data(amount=random_amount, **name_kwargs)
        data.update(self.get_data_as_formset())

        # sanity check
        self.assertRaises(models.Donor.DoesNotExist, models.Donor.objects.get,
                          **name_kwargs)
        with override_settings(ARMSTRONG_DONATION_FORM="SimpleDonationForm"):
            self.client.post(self.url, data)
        donor = models.Donor.objects.get(**name_kwargs)
        self.assertEqual(str(donor), " ".join(name_kwargs.values()))
        donation = models.Donation.objects.get(donor=donor)
        self.assertEqual(donation.amount, random_amount)
예제 #3
0
    def test_saves_donation_on_post_with_minimal_information(self):
        name_kwargs = self.random_donor_kwargs
        random_amount = self.random_amount
        data = self.get_base_random_data(amount=random_amount,
                **name_kwargs)
        data.update(self.get_data_as_formset())

        # sanity check
        self.assertRaises(models.Donor.DoesNotExist,
                models.Donor.objects.get, **name_kwargs)
        with override_settings(ARMSTRONG_DONATION_FORM="SimpleDonationForm"):
            self.client.post(self.url, data)
        donor = models.Donor.objects.get(**name_kwargs)
        self.assertEqual(str(donor), " ".join(name_kwargs.values()))
        donation = models.Donation.objects.get(donor=donor)
        self.assertEqual(donation.amount, random_amount)