def test_if_deduplicates_when_recipient_repeated_in_field(self): mail = InputMail.from_dict(duplicates_in_fields_mail_dict(), from_address='pixelated@org') yield self.mail_service._deduplicate_recipients(mail) self.assertItemsEqual(['*****@*****.**', '*****@*****.**'], mail.bcc) self.assertItemsEqual(['*****@*****.**', '*****@*****.**'], mail.to) self.assertItemsEqual(['*****@*****.**'], mail.cc)
def test_if_recipient_doubled_in_fields_send_only_in_bcc(self): mail = InputMail.from_dict(duplicates_in_fields_mail_dict(), from_address='pixelated@org') yield self.mail_service._deduplicate_recipients(mail) self.assertIn('*****@*****.**', mail.to) self.assertNotIn('*****@*****.**', mail.to) self.assertIn('*****@*****.**', mail.bcc)
def setUp(self): self.drafts = mock() self.mail_store = mock() self.attachment_store = mock() self.mailboxes = mock() self.mailboxes.drafts = defer.succeed(self.drafts) self.mailboxes.trash = mock() self.mailboxes.sent = mock() self.mail_sender = mock() self.search_engine = mock() self.mail_service = MailService(self.mail_sender, self.mail_store, self.search_engine, 'acount@email', self.attachment_store) self.mail = InputMail.from_dict(duplicates_in_fields_mail_dict(), from_address='pixelated@org')