Exemplo n.º 1
0
    def test_update_search_ctr(self, search_ctr):
        """Verify the cron job inserts the right rows."""
        clicks_kind = MetricKindFactory(code=SEARCH_CLICKS_METRIC_CODE)
        MetricKindFactory(code=SEARCH_SEARCHES_METRIC_CODE)
        search_ctr.return_value = {"2013-06-06": 42.123456789, "2013-06-07": 13.7654321, "2013-06-08": 99.55555}

        update_search_ctr_metric()

        metrics = Metric.objects.filter(kind=clicks_kind).order_by("start")
        eq_(3, len(metrics))
        eq_(421, metrics[0].value)
        eq_(138, metrics[1].value)
        eq_(date(2013, 6, 8), metrics[2].start)
Exemplo n.º 2
0
    def test_update_search_ctr(self, search_ctr):
        """Verify the cron job inserts the right rows."""
        clicks_kind = metric_kind(code=SEARCH_CLICKS_METRIC_CODE, save=True)
        metric_kind(code=SEARCH_SEARCHES_METRIC_CODE, save=True)
        search_ctr.return_value = {'2013-06-06': 42.123456789,
                                   '2013-06-07': 13.7654321,
                                   '2013-06-08': 99.55555}

        update_search_ctr_metric()

        metrics = Metric.objects.filter(kind=clicks_kind).order_by('start')
        eq_(3, len(metrics))
        eq_(421, metrics[0].value)
        eq_(138, metrics[1].value)
        eq_(date(2013, 6, 8), metrics[2].start)
Exemplo n.º 3
0
    def test_update_search_ctr(self, search_ctr):
        """Verify the cron job inserts the right rows."""
        clicks_kind = metric_kind(code=SEARCH_CLICKS_METRIC_CODE, save=True)
        metric_kind(code=SEARCH_SEARCHES_METRIC_CODE, save=True)
        search_ctr.return_value = {
            '2013-06-06': 42.123456789,
            '2013-06-07': 13.7654321,
            '2013-06-08': 99.55555
        }

        update_search_ctr_metric()

        metrics = Metric.objects.filter(kind=clicks_kind).order_by('start')
        eq_(3, len(metrics))
        eq_(421, metrics[0].value)
        eq_(138, metrics[1].value)
        eq_(date(2013, 6, 8), metrics[2].start)