test_alert_if_org_is_absent.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:intake 作者: codeforamerica 项目源码 文件源码
def test_alerts_with_old_logins_and_unopened_apps(self):
        user1 = UserFactory(last_login=old_login_date)
        user2 = UserFactory(last_login=old_login_date - timedelta(days=2))
        user3 = UserFactory(last_login=None)
        UserProfileFactory(user=user1, organization=self.org)
        UserProfileFactory(user=user2, organization=self.org)
        UserProfileFactory(user=user3, organization=self.org)
        self.run_command()
        self.assertEqual(1, len(mail.outbox))
        email = mail.outbox[0]
        expected_subject = "Inactive organization on localhost:8000"
        expected_body = "Alameda County Pubdef has not logged in since " \
                        "{} and has 1 unopened applications".format(
                            old_login_date.strftime("%a %b %-d %Y"))
        self.assertEqual(expected_subject, email.subject)
        self.assertIn(expected_body, email.body)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号