Ejemplo n.º 1
0
 def test_left_monthly(self):
     ''' test method Dashboard.left_monthly() '''
     
     # Empty database has no users
     self.failUnlessEqual(Dashboard.left_monthly(), 0)
     
     # create 1 user which left 20 days before
     u = self.getUser()
     date = datetime.datetime.now() - datetime.timedelta(days=20)         
     
     s = Subscription(owner=u, monthly_fee=0)        
     s.date_cancelled = date
     s.date_deleted = date
     s.save()
     
     self.failUnlessEqual(Dashboard.left_monthly(), 1)
 
     # Delete all data
     u.delete()        
     self.failUnlessEqual(Dashboard.left_monthly(), 0)
Ejemplo n.º 2
0
 def test_left_daily(self):
     ''' test method Dashboard.left_daily() '''
     u = self.getUser()
     now = datetime.datetime.now()
     
     # Empty database has no users
     self.failUnlessEqual(Dashboard.left_daily(), 0)
     
     # create 1 user which left today
     s = Subscription(owner=u, monthly_fee=0)        
     s.date_cancelled = now
     s.date_deleted = now
     s.save()
     
     self.failUnlessEqual(Dashboard.left_daily(), 1)
     
     # Delete all data
     u.delete()        
     self.failUnlessEqual(Dashboard.left_monthly(), 0)