本文整理汇总了Python中stats.tasks._get_daily_jobs函数的典型用法代码示例。如果您正苦于以下问题:Python _get_daily_jobs函数的具体用法?Python _get_daily_jobs怎么用?Python _get_daily_jobs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_get_daily_jobs函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_user_total
def test_user_total(self):
day = datetime.date(2009, 1, 1)
p = UserProfile.objects.create(username='foo',
source=amo.LOGIN_SOURCE_MMO_BROWSERID)
p.update(created=day)
eq_(tasks._get_daily_jobs(day)['mmo_user_count_total'](), 1)
eq_(tasks._get_daily_jobs()['mmo_user_count_total'](), 1)
eq_(tasks._get_daily_jobs()['mmo_user_count_new'](), 0)
示例2: test_app_added_counts
def test_app_added_counts(self):
app = Addon.objects.create(type=amo.ADDON_WEBAPP)
regions = dict(REGIONS_CHOICES_SLUG)
# Add a region exclusion.
excluded_region = regions['br']
app.addonexcludedregion.create(region=excluded_region.id)
jobs = tasks._get_daily_jobs()
# Check package type counts.
for region_slug in regions.keys():
expected_count = 0 if region_slug == excluded_region.slug else 1
count = jobs['apps_added_%s_hosted' % region_slug]()
eq_(count, expected_count,
'Incorrect count for region %s. Got %d, expected %d.' % (
region_slug, count, expected_count))
# Check premium type counts.
for region_slug in regions.keys():
expected_count = 0 if region_slug == excluded_region.slug else 1
count = jobs['apps_added_%s_free' % region_slug]()
eq_(count, expected_count,
'Incorrect count for region %s. Got %d, expected %d.' % (
region_slug, count, expected_count))
示例3: test_dev_total
def test_dev_total(self):
p1 = UserProfile.objects.create(username='foo',
source=amo.LOGIN_SOURCE_MMO_BROWSERID)
p2 = UserProfile.objects.create(username='bar',
source=amo.LOGIN_SOURCE_MMO_BROWSERID)
a1 = amo.tests.addon_factory()
a2 = amo.tests.app_factory()
AddonUser.objects.create(addon=a1, user=p1)
AddonUser.objects.create(addon=a1, user=p2)
AddonUser.objects.create(addon=a2, user=p1)
eq_(tasks._get_daily_jobs()['mmo_developer_count_total'](), 1)
示例4: test_user_new
def test_user_new(self):
UserProfile.objects.create(username='foo',
source=amo.LOGIN_SOURCE_MMO_BROWSERID)
eq_(tasks._get_daily_jobs()['mmo_user_count_new'](), 1)
示例5: test_input
def test_input(self):
for x in ['2009-1-1',
datetime.datetime(2009, 1, 1),
datetime.datetime(2009, 1, 1, 11, 0)]:
with self.assertRaises((TypeError, ValueError)):
tasks._get_daily_jobs(x)
示例6: test_app_reviews
def test_app_reviews(self):
addon = Addon.objects.create(type=amo.ADDON_WEBAPP)
user = UserProfile.objects.create(username='foo')
Review.objects.create(addon=addon, user=user)
eq_(tasks._get_daily_jobs()['apps_review_count_new'](), 1)
示例7: test_apps_installed
def test_apps_installed(self):
addon = Addon.objects.create(type=amo.ADDON_WEBAPP)
user = UserProfile.objects.create(username='foo')
Installed.objects.create(addon=addon, user=user)
eq_(tasks._get_daily_jobs()['apps_count_installed'](), 1)
示例8: test_app_new
def test_app_new(self):
Addon.objects.create(type=amo.ADDON_WEBAPP)
eq_(tasks._get_daily_jobs()['apps_count_new'](), 1)
示例9: test_marketplace_stats
def test_marketplace_stats(self):
res = tasks._get_daily_jobs()
for k in ['apps_count_new', 'apps_count_installed',
'apps_review_count_new']:
assert k in res, 'Job %s missing from _get_daily_jobs' % k