本文整理汇总了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)
示例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})