Example #1
0
 def test_get_average_donation_amount(self):
     donation = Donation(amount=500).save()
     donation.mission.connect(self.mission)
     donation2 = Donation(amount=2500).save()
     donation2.mission.connect(self.mission)
     res = self.mission.get_average_donation_amount()
     self.assertEqual(res, "15.00")
Example #2
0
 def test_get_total_donation_amount(self):
     donation1 = Donation(amount=100).save()
     donation2 = Donation(amount=200).save()
     donation1.mission.connect(self.mission)
     donation2.mission.connect(self.mission)
     res = self.mission.get_total_donation_amount()
     self.assertEqual(res, "2.25")
Example #3
0
 def test_get_donations(self):
     donation = Donation(amount=100).save()
     mission = Mission().save()
     self.quest.missions.connect(mission)
     donation.mission.connect(mission)
     donation.quest.connect(self.quest)
     res = Quest.get_donations(self.quest.owner_username)
     self.assertEqual(donation.object_uuid, res[0].object_uuid)
Example #4
0
 def test_get_donors(self):
     donation = Donation(amount=500,
                         completed=True,
                         owner_username=self.owner.username).save()
     donation.owned_by.connect(self.owner)
     donation.mission.connect(self.mission)
     cache.clear()
     res = Mission.get_donors(self.mission.object_uuid)
     self.assertEqual(res[0], self.owner.username)
 def setUp(self):
     cache.clear()
     self.unit_under_test_name = 'goal'
     self.email = "*****@*****.**"
     self.pleb = create_user_util_test(self.email)
     self.user = User.objects.get(email=self.email)
     self.email2 = "*****@*****.**"
     self.pleb2 = create_user_util_test(self.email2)
     self.user2 = User.objects.get(email=self.email2)
     self.url = "http://testserver"
     self.donation = Donation(completed=False,
                              amount=1000,
                              owner_username=self.user.username).save()
 def setUp(self):
     cache.clear()
     self.unit_under_test_name = 'donations'
     self.email = "*****@*****.**"
     create_user_util_test(self.email)
     self.pleb = Pleb.nodes.get(email=self.email)
     self.user = User.objects.get(email=self.email)
     self.url = "http://testserver"
     self.donation = Donation(completed=False,
                              amount=1000,
                              owner_username=self.user.username).save()
     self.pleb.is_verified = True
     self.pleb.save()
     cache.set(self.pleb.username, self.pleb)
 def test_get_sagebrew_donations(self):
     donation = Donation(amount=100).save()
     self.pleb.donations.connect(donation)
     donation.owned_by.connect(self.pleb)
     self.assertTrue(self.pleb.get_sagebrew_donations())
Example #8
0
 def test_get_donations(self):
     donation = Donation(amount=500).save()
     donation.mission.connect(self.mission)
     res = Mission.get_donations(self.mission.object_uuid)
     self.assertEqual(res[0].object_uuid, donation.object_uuid)