Exemple #1
0
    def test_send_mail_reporter_created(self):
        num_of_messages = reporter_mail.send_mail_reporter_created(self.signal)

        self.assertEqual(num_of_messages, 1)
        self.assertEqual(len(mail.outbox), 1)
        self.assertEqual(mail.outbox[0].subject, f'Bedankt voor uw melding ({self.signal.id})')
        self.assertEqual(mail.outbox[0].to, ['*****@*****.**', ])

        self.assertIn('10 oktober 2018 12:00', mail.outbox[0].body)
Exemple #2
0
    def test_send_mail_reporter_created_custom_handling_message(self):
        category = self.signal.category_assignment.category
        category.handling_message = 'This text should end up in the mail to the reporter'
        category.save()
        self.signal.refresh_from_db()

        num_of_messages = reporter_mail.send_mail_reporter_created(self.signal)

        self.assertEqual(num_of_messages, 1)
        self.assertEqual(len(mail.outbox), 1)
        self.assertEqual(mail.outbox[0].subject,
                         f'Bedankt voor uw melding ({self.signal.id})')
        self.assertEqual(mail.outbox[0].to, [
            '*****@*****.**',
        ])

        self.assertIn('10 oktober 2018 12:00', mail.outbox[0].body)
        self.assertIn(category.handling_message, mail.outbox[0].body)
Exemple #3
0
    def test_send_mail_reporter_created_no_email(self):
        num_of_messages = reporter_mail.send_mail_reporter_created(self.signal_no_email)

        self.assertEqual(num_of_messages, None)
Exemple #4
0
def send_mail_reporter_created(pk):
    signal = Signal.objects.get(pk=pk)
    mail.send_mail_reporter_created(signal)