def test_ask_google(self, build, gpi, http): gpi.return_value = '1' d = '2012-01-01' get = build('analytics', 'v3', http=http).data().ga().get( metrics='ga:visits', ids='ga:1', start_date=d, end_date=d) get.execute.return_value = {'rows': [[49]]} cron.update_google_analytics(d) eq_(GlobalStat.objects.get(name='webtrends_DailyVisitors', date=d).count, 49)
def test_ask_google(self, build, gpi, http): gpi.return_value = "1" d = "2012-01-01" get = ( build("analytics", "v3", http=http) .data() .ga() .get(metrics="ga:visits", ids="ga:1", start_date=d, end_date=d) ) get.execute.return_value = {"rows": [[49]]} cron.update_google_analytics(d) eq_(GlobalStat.objects.get(name="webtrends_DailyVisitors", date=d).count, 49)