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)
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)
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)