Esempio n. 1
0
 def test_desc_order(self):
     """
     Check the returned data is in descending order by date.
     """
     d_range = (datetime.date(2012, 05, 01), datetime.date(2012, 05, 15))
     stats = list(get_series(Contribution, "day", addon=self.app.pk, date__range=d_range))
     eq_(stats, sorted(stats, key=lambda x: x["date"], reverse=True))
Esempio n. 2
0
 def test_basic(self):
     """
     Check a sale (count) is found for each day in the expected range.
     """
     d_range = (datetime.date(2012, 05, 01), datetime.date(2012, 05, 15))
     stats = list(get_series(Contribution, "day", addon=self.app.pk, date__range=d_range))
     dates_with_sales = [c["date"] for c in stats if c["count"] > 0]
     for day in self.expected_days:
         assert (day in [d.day for d in dates_with_sales], "%s not in data" % day)
Esempio n. 3
0
 def test_desc_order(self):
     """
     Check the returned data is in descending order by date.
     """
     d_range = (datetime.date(2012, 05, 01), datetime.date(2012, 05, 15))
     stats = list(
         get_series(Contribution,
                    'day',
                    addon=self.app.pk,
                    date__range=d_range))
     eq_(stats, sorted(stats, key=lambda x: x['date'], reverse=True))
Esempio n. 4
0
 def test_basic(self):
     """
     Check a sale (count) is found for each day in the expected range.
     """
     d_range = (datetime.date(2012, 05, 01), datetime.date(2012, 05, 15))
     stats = list(
         get_series(Contribution,
                    'day',
                    addon=self.app.pk,
                    date__range=d_range))
     dates_with_sales = [c['date'] for c in stats if c['count'] > 0]
     days = [d.day for d in dates_with_sales]
     for day in self.expected_days:
         eq_(day in days, True)