本文整理汇总了Python中osf_tests.factories.UserFactory.date_last_login方法的典型用法代码示例。如果您正苦于以下问题:Python UserFactory.date_last_login方法的具体用法?Python UserFactory.date_last_login怎么用?Python UserFactory.date_last_login使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类osf_tests.factories.UserFactory
的用法示例。
在下文中一共展示了UserFactory.date_last_login方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_find_inactive_users_with_no_inactivity_email_sent_or_queued
# 需要导入模块: from osf_tests.factories import UserFactory [as 别名]
# 或者: from osf_tests.factories.UserFactory import date_last_login [as 别名]
def test_find_inactive_users_with_no_inactivity_email_sent_or_queued(self, mock_mail):
user_active = UserFactory(fullname='Spot')
user_inactive = UserFactory(fullname='Nucha')
user_already_received_mail = UserFactory(fullname='Pep')
user_active.date_last_login = timezone.now() - timedelta(seconds=6)
user_inactive.date_last_login = timezone.now() - timedelta(weeks=6)
user_already_received_mail.date_last_login = timezone.now() - timedelta(weeks=6)
user_active.save()
user_inactive.save()
user_already_received_mail.save()
mails.queue_mail(to_addr=user_already_received_mail.username,
send_at=timezone.now(),
user=user_already_received_mail,
mail=mails.NO_LOGIN)
users = find_inactive_users_with_no_inactivity_email_sent_or_queued()
assert_equal(len(users), 1)