def test_the_email_answer_can_have_attachments(self): '''An email answer can have attachments''' email_answer = EmailAnswer() email_answer.subject = 'prueba4' email_answer.content_text = 'prueba4lafieritaespeluda' email_answer.add_attachment(self.photo_fiera) email_answer.add_attachment(self.pdf_file) self.assertTrue(email_answer.attachments) self.assertIn(self.photo_fiera, email_answer.attachments) self.assertIn(self.pdf_file, email_answer.attachments)
def test_save_attachments_on_save(self): '''When saving it also calls the save an attachment''' email_answer = EmailAnswer() outbound_identifier = self.message.outbound_identifiers.get(person=self.candidate1) email_answer.answer_identifier = outbound_identifier.key email_answer.subject = 'prueba4' email_answer.content_text = 'prueba4lafieritaespeluda' email_answer.add_attachment(self.photo_fiera) email_answer.add_attachment(self.pdf_file) answer = email_answer.save() self.assertTrue(answer.attachments.filter(name=self.photo_fiera.name)) self.assertTrue(answer.attachments.filter(name=self.pdf_file.name))
def test_save_attachments_on_save(self): '''When saving it also calls the save an attachment''' email_answer = EmailAnswer() outbound_identifier = self.message.outbound_identifiers.get( person=self.candidate1) email_answer.answer_identifier = outbound_identifier.key email_answer.subject = 'prueba4' email_answer.content_text = 'prueba4lafieritaespeluda' email_answer.add_attachment(self.photo_fiera) email_answer.add_attachment(self.pdf_file) answer = email_answer.save() self.assertTrue(answer.attachments.filter(name=self.photo_fiera.name)) self.assertTrue(answer.attachments.filter(name=self.pdf_file.name))