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


Python SavedSearchFactory.initial_email方法代码示例

本文整理汇总了Python中mysearches.tests.factories.SavedSearchFactory.initial_email方法的典型用法代码示例。如果您正苦于以下问题:Python SavedSearchFactory.initial_email方法的具体用法?Python SavedSearchFactory.initial_email怎么用?Python SavedSearchFactory.initial_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mysearches.tests.factories.SavedSearchFactory的用法示例。


在下文中一共展示了SavedSearchFactory.initial_email方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_initial_email

# 需要导入模块: from mysearches.tests.factories import SavedSearchFactory [as 别名]
# 或者: from mysearches.tests.factories.SavedSearchFactory import initial_email [as 别名]
    def test_initial_email(self):
        search = SavedSearchFactory(user=self.user, is_active=False,
                                    url='www.my.jobs/search?q=new+search')
        search.initial_email()
        self.assertEqual(len(mail.outbox), 1)
        self.assertEqual(SavedSearchLog.objects.count(), 1)
        log = SavedSearchLog.objects.get()
        self.assertTrue('Jobs are not sent' in log.reason)
        self.assertTrue(log.was_sent)

        email = mail.outbox.pop()
        self.assertEqual(email.from_email, 'My.jobs Saved Search <[email protected]>')
        self.assertEqual(email.to, [self.user.email])
        self.assertEqual("My.jobs New Saved Search" in email.subject, True)
        self.assertTrue("table" in email.body)
        self.assertTrue(email.to[0] in email.body)
        # Search url appears twice - once displaying the saved search source
        # and once in the view link.
        self.assertEqual(email.body.count(search.url), 2)
开发者ID:zeus911,项目名称:MyJobs,代码行数:21,代码来源:test_models.py

示例2: test_saved_search_invitation_context

# 需要导入模块: from mysearches.tests.factories import SavedSearchFactory [as 别名]
# 或者: from mysearches.tests.factories.SavedSearchFactory import initial_email [as 别名]
    def test_saved_search_invitation_context(self):
        """
        Test that creating an invitation context from a saved search instance
        produces a context with a message, the saved search itself, an unsent
        initial email, and whether that saved search is text only.

        """
        saved_search = SavedSearchFactory(user=self.user, text_only=True)
        context = invitation_context(saved_search)

        self.assertEqual(context, {
            "message": " in order to begin receiving their available job "
                       "opportunities on a regular basis.",
            "saved_search": saved_search,
            "initial_search_email": saved_search.initial_email(send=False),
            "text_only": saved_search.text_only})
开发者ID:DirectEmployers,项目名称:MyJobs,代码行数:18,代码来源:test_helpers.py


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