@patch.object(googleanalytics, 'visitors')
    def test_update_visitors_cron(self, visitors):
        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)
Verify the cron job inserts the right rows.
dataset/ETHPy150Open mozilla/kitsune/kitsune/kpi/tests/test_cron.py/CronJobTests.test_update_visitors_cron