Exemplo 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_line(Contribution, 'day', addon=self.app.pk,
                                  date__range=d_range))
     eq_(stats, sorted(stats, key=lambda x: x['date'], reverse=True))
Exemplo n.º 2
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_line(Contribution, 'day', addon=self.app.pk,
                                  date__range=d_range))
     eq_(stats, sorted(stats, key=lambda x: x['date'], reverse=True))
Exemplo n.º 3
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_line(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)
Exemplo 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_line(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)
Exemplo n.º 5
0
    def test_revenue(self):
        """
        Check each day's revenue is correct.
        """
        d_range = (datetime.date(2012, 05, 01), datetime.date(2012, 05, 05))
        stats = list(get_series_line(Contribution, 'day',
                                     primary_field='revenue',
                                     addon=self.app.pk,
                                     date__range=d_range))

        for stat, day in zip(stats, sorted(self.expected_days, reverse=True)):
            expected_revenue = day * .99
            eq_(round(stat['count'], 2), round(expected_revenue, 2))
Exemplo n.º 6
0
    def test_revenue(self):
        """
        Check each day's revenue is correct.
        """
        d_range = (datetime.date(2012, 05, 01), datetime.date(2012, 05, 05))
        stats = list(get_series_line(Contribution, 'day',
                                     primary_field='revenue',
                                     addon=self.app.pk,
                                     date__range=d_range))

        for stat, day in zip(stats, sorted(self.expected_days, reverse=True)):
            expected_revenue = day * .99
            eq_(round(stat['count'], 2), round(expected_revenue, 2))