def test_not_send_anything_if_user_does_not_have_proposals(self):
     user = User.objects.create_user(username="******", email="*****@*****.**")
     initial_amount_of_mails = len(mail.outbox)
     r = PeriodicReporter(user)
     r.send_mail()
     amount_of_mails = len(mail.outbox)
     self.assertEquals(amount_of_mails, initial_amount_of_mails)
コード例 #2
0
def report_sender_task():
    users_with_proposals = User.objects.exclude(proposals__isnull=True)
    if not config.PERIODIC_REPORTS_ENABLED:
        users_with_proposals = users_with_proposals.filter(is_staff=True)
    for u in users_with_proposals:
        r = PeriodicReporter(u)
        r.send_mail()
 def test_not_send_anything_if_user_does_not_have_proposals(self):
     user = User.objects.create_user(username="******",
                                     email="*****@*****.**")
     initial_amount_of_mails = len(mail.outbox)
     r = PeriodicReporter(user)
     r.send_mail()
     amount_of_mails = len(mail.outbox)
     self.assertEquals(amount_of_mails, initial_amount_of_mails)
 def test_send_mail(self):
     initial_amount_of_mails = len(mail.outbox)
     r = PeriodicReporter(self.fiera)
     r.send_mail()
     amount_of_mails = len(mail.outbox)
     self.assertEquals(amount_of_mails, initial_amount_of_mails + 1)
     the_mail = mail.outbox[amount_of_mails - 1]
     self.assertEquals(len(the_mail.to), 1)
     self.assertIn(self.fiera.email, the_mail.to)
 def test_send_mail(self):
     initial_amount_of_mails = len(mail.outbox)
     r = PeriodicReporter(self.fiera)
     r.send_mail()
     amount_of_mails = len(mail.outbox)
     self.assertEquals(amount_of_mails, initial_amount_of_mails + 1)
     the_mail = mail.outbox[amount_of_mails - 1]
     self.assertEquals(len(the_mail.to), 1)
     self.assertIn(self.fiera.email, the_mail.to)
コード例 #6
0
def report_sender_task():
    users_with_proposals = User.objects.exclude(proposals__isnull=True)

    if not config.PERIODIC_REPORTS_ENABLED:
        users_with_proposals = users_with_proposals.filter(is_staff=True)

    for u in users_with_proposals:
        r = PeriodicReporter(u)
        r.send_mail()
    ##
    send_mails_to_staff({'number': users_with_proposals}, 'notice_to_staff_of_periodic_reports')
コード例 #7
0
def report_sender_task():
    users_with_proposals = User.objects.exclude(proposals__isnull=True)

    if not config.PERIODIC_REPORTS_ENABLED:
        users_with_proposals = users_with_proposals.filter(is_staff=True)

    for u in users_with_proposals:
        r = PeriodicReporter(u)
        r.send_mail()
    ##
    send_mails_to_staff({'number': users_with_proposals},
                        'notice_to_staff_of_periodic_reports')
 def test_sending_mail_with_recomendation_comes_with_new_proposals(self):
     initial_amount_of_mails = len(mail.outbox)
     r = PeriodicReporter(self.fiera)
     r.send_mail()
     amount_of_mails = len(mail.outbox)
     self.assertEquals(amount_of_mails, initial_amount_of_mails + 1)
 def test_sending_mail_with_recomendation_comes_with_new_proposals(self):
     initial_amount_of_mails = len(mail.outbox)
     r = PeriodicReporter(self.fiera)
     r.send_mail()
     amount_of_mails = len(mail.outbox)
     self.assertEquals(amount_of_mails, initial_amount_of_mails + 1)