def staff_digest(): """Send out staff digest""" staff_users = User.objects.filter(is_staff=True).distinct() for staff_user in staff_users: email = digests.StaffDigest(user=staff_user, subject=u'Daily Staff Digest') email.send()
def test_not_staff(self): """The digest should not send to users who are not staff.""" not_staff = UserFactory() digest = digests.StaffDigest(user=not_staff) eq_(digest.send(), 0)
def test_send(self): """The digest should send to staff members without errors.""" digest = digests.StaffDigest(user=self.user) eq_(digest.send(), 1)