예제 #1
0
    def test_update_visitors_cron(self, visitors):
        """Verify the cron job inserts the right rows."""
        visitor_kind = MetricKindFactory(code=VISITORS_METRIC_CODE)
        visitors.return_value = {"2012-01-13": 42, "2012-01-14": 193, "2012-01-15": 33}

        update_visitors_metric()

        metrics = Metric.objects.filter(kind=visitor_kind).order_by("start")
        eq_(3, len(metrics))
        eq_(42, metrics[0].value)
        eq_(193, metrics[1].value)
        eq_(date(2012, 1, 15), metrics[2].start)
예제 #2
0
    def test_update_visitors_cron(self, visitors):
        """Verify the cron job inserts the right rows."""
        visitor_kind = metric_kind(code=VISITORS_METRIC_CODE, save=True)
        visitors.return_value = {'2012-01-13': 42,
                                 '2012-01-14': 193,
                                 '2012-01-15': 33}

        update_visitors_metric()

        metrics = Metric.objects.filter(kind=visitor_kind).order_by('start')
        eq_(3, len(metrics))
        eq_(42, metrics[0].value)
        eq_(193, metrics[1].value)
        eq_(date(2012, 01, 15), metrics[2].start)
예제 #3
0
파일: test_cron.py 프로젝트: zctyhj/kitsune
    def test_update_visitors_cron(self, visitors):
        """Verify the cron job inserts the right rows."""
        visitor_kind = metric_kind(code=VISITORS_METRIC_CODE, save=True)
        visitors.return_value = {
            '2012-01-13': 42,
            '2012-01-14': 193,
            '2012-01-15': 33
        }

        update_visitors_metric()

        metrics = Metric.objects.filter(kind=visitor_kind).order_by('start')
        eq_(3, len(metrics))
        eq_(42, metrics[0].value)
        eq_(193, metrics[1].value)
        eq_(date(2012, 01, 15), metrics[2].start)