本文整理汇总了Python中mysearches.tests.factories.SavedSearchFactory.last_sent方法的典型用法代码示例。如果您正苦于以下问题:Python SavedSearchFactory.last_sent方法的具体用法?Python SavedSearchFactory.last_sent怎么用?Python SavedSearchFactory.last_sent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysearches.tests.factories.SavedSearchFactory
的用法示例。
在下文中一共展示了SavedSearchFactory.last_sent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_requeue_monthly_saved_search
# 需要导入模块: from mysearches.tests.factories import SavedSearchFactory [as 别名]
# 或者: from mysearches.tests.factories.SavedSearchFactory import last_sent [as 别名]
def test_requeue_monthly_saved_search(self):
"""
Tests that monthly saved searches are requeued correctly individually
in addition to as part of a digest.
"""
today = datetime.date.today()
two_days_ago = today.day - 2
if two_days_ago < 0:
two_days_ago += 31
elif two_days_ago == 0:
two_days_ago = 30
digest = SavedSearchDigestFactory(user=self.user, is_active=True)
search = SavedSearchFactory(user=self.user, is_active=True,
frequency='M', day_of_month=two_days_ago)
self.requeue(search, digest)
digest.is_active = False
digest.save()
search.last_sent = None
search.save()
mail.outbox = []
self.requeue(search, digest)
示例2: test_requeue_weekly_saved_search
# 需要导入模块: from mysearches.tests.factories import SavedSearchFactory [as 别名]
# 或者: from mysearches.tests.factories.SavedSearchFactory import last_sent [as 别名]
def test_requeue_weekly_saved_search(self):
"""
Tests that weekly saved searches are requeued correctly individually in
addition to as part of a digest.
"""
today = datetime.date.today()
two_days_ago = today.isoweekday() - 2
two_month_days_ago = today.day - 2
if two_days_ago <= 0:
# Dates can't be negative or zero
two_days_ago += 7
if two_month_days_ago == 0:
# According to mysearches/models.py, we can't have saved searches on
# the 31st. If two_month_days_ago==0, this would be the 31st.
two_days_ago -= 1
digest = SavedSearchDigestFactory(user=self.user, is_active=True)
search = SavedSearchFactory(user=self.user, is_active=True,
frequency='W', day_of_week=two_days_ago)
self.requeue(search, digest)
digest.is_active = False
digest.save()
search.last_sent = None
search.save()
mail.outbox = []
self.requeue(search, digest)
示例3: test_requeue_monthly_saved_search
# 需要导入模块: from mysearches.tests.factories import SavedSearchFactory [as 别名]
# 或者: from mysearches.tests.factories.SavedSearchFactory import last_sent [as 别名]
def test_requeue_monthly_saved_search(self):
"""
Tests that monthly saved searches are requeued correctly individually
in addition to as part of a digest.
"""
today = datetime.date.today().day
last_week = today - 7
if last_week <= 0:
last_week += 31
digest = SavedSearchDigestFactory(user=self.user,
is_active=True)
search = SavedSearchFactory(user=self.user, is_active=True,
frequency='M', day_of_month=last_week)
self.requeue(search, digest)
digest.is_active = False
digest.save()
search.last_sent = None
search.save()
mail.outbox = []
self.requeue(search, digest)