예제 #1
0
 def test_percent_community(self):
     account = models.Account()
     account.community_contribution = 80
     account.goal = 80
     self.assertEqual(50, account.percent_community())  # 80/160
     account.community_contribution = 100
     self.assertEqual(55.56, account.percent_community())  # 100/180
예제 #2
0
 def test_percent_raised(self):
     account = models.Account()
     account.donations = []
     account.current = 30
     account.community_contribution = 10
     account.goal = 70
     self.assertEqual(50, account.percent_raised())  # 40/80
     account.current += 20
     self.assertEqual(75, account.percent_raised())  # 60/80
예제 #3
0
 def test_funded(self):
     account = models.Account()
     self.assertFalse(account.funded())
     account.current = 100
     self.assertFalse(account.funded())
     account.goal = 101
     self.assertFalse(account.funded())
     account.goal = 100
     self.assertTrue(account.funded())
     account.goal = 99
     self.assertTrue(account.funded())