当前位置: 首页>>代码示例>>Python>>正文


Python SavedSearchFactory.last_sent方法代码示例

本文整理汇总了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)
开发者ID:kepinq,项目名称:MyJobs,代码行数:27,代码来源:test_models.py

示例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)
开发者ID:kepinq,项目名称:MyJobs,代码行数:31,代码来源:test_models.py

示例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)
开发者ID:wejhink,项目名称:MyJobs,代码行数:25,代码来源:test_models.py


注:本文中的mysearches.tests.factories.SavedSearchFactory.last_sent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。