def test_getter_removes_the_identifier(self):
     email_answer = EmailAnswer()
     email_answer.subject = 'prueba4'
     email_answer.answer_identifier = '8974aabsdsfierapulgosa'
     email_answer.content_text = 'prueba4lafieritaespeluda y lo mandé desde este mail [email protected]'
     self.assertFalse(email_answer.answer_identifier in email_answer.content_text)
     self.assertNotIn("*****@*****.**", email_answer.content_text)
Ejemplo n.º 2
0
 def test_getter_removes_the_identifier(self):
     email_answer = EmailAnswer()
     email_answer.subject = 'prueba4'
     email_answer.answer_identifier = '8974aabsdsfierapulgosa'
     email_answer.content_text = 'prueba4lafieritaespeluda y lo mandé desde este mail [email protected]'
     self.assertFalse(
         email_answer.answer_identifier in email_answer.content_text)
     self.assertNotIn("*****@*****.**", email_answer.content_text)
 def test_email_answer_save(self):
     email_answer = EmailAnswer()
     email_answer.subject = 'prueba4'
     outbound_identifier = self.message.outbound_identifiers.get(person=self.candidate1)
     email_answer.answer_identifier = outbound_identifier.key
     email_answer.content_text = 'Hola Hola esto es una prueba'
     answer = email_answer.save()
     self.assertIsInstance(answer, Answer)
     self.assertEquals(answer.message, self.message)
     self.assertEquals(answer.content, email_answer.content_text)
    def test_class_answer(self):
        email_answer = EmailAnswer()
        self.assertTrue(hasattr(email_answer, 'subject'))
        self.assertTrue(hasattr(email_answer, '_content_text'))
        self.assertTrue(hasattr(email_answer, 'content_html'))
        self.assertTrue(hasattr(email_answer, 'answer_identifier'))
        self.assertTrue(hasattr(email_answer, 'email_from'))
        self.assertTrue(hasattr(email_answer, 'email_to'))
        self.assertTrue(hasattr(email_answer, 'when'))
        self.assertTrue(hasattr(email_answer, 'message_id'))
        email_answer.subject = 'prueba4'
        email_answer.content_text = 'prueba4lafieritaespeluda'
        email_answer.content_html = '<p>prueba4lafieritaespeluda</p>'
        email_answer.answer_identifier = '8974aabsdsfierapulgosa'
        email_answer.email_from = '*****@*****.**'
        email_answer.email_to = 'Felipe <*****@*****.**>'
        email_answer.when = 'Wed Jun 26 21:05:33 2013'
        email_answer.message_id = '<CAA5PczfGfdhf29wgK=8t6j7hm8HYsBy8Qg87iTU2pF42Ez3VcQ@mail.gmail.com>'

        self.assertTrue(email_answer)
        self.assertEquals(email_answer.subject, 'prueba4')
        self.assertEquals(email_answer.content_text, 'prueba4lafieritaespeluda')
        self.assertEquals(email_answer.answer_identifier, '8974aabsdsfierapulgosa')
        self.assertEquals(email_answer.email_from, '*****@*****.**')
        self.assertEquals(email_answer.email_to, 'Felipe <*****@*****.**>')
        self.assertEquals(email_answer.when, 'Wed Jun 26 21:05:33 2013')
        self.assertEquals(email_answer.message_id, '<CAA5PczfGfdhf29wgK=8t6j7hm8HYsBy8Qg87iTU2pF42Ez3VcQ@mail.gmail.com>')
        self.assertEquals(email_answer.content_html, '<p>prueba4lafieritaespeluda</p>')
Ejemplo n.º 5
0
 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))
 def test_it_doesnt_contain_anything_of_the_original_email(self):
     '''If I set the "To" header in the email and use it in the email_answer.recipient
     then I should not be getting her/his email address in the content'''
     email_answer = EmailAnswer()
     email_answer.subject = 'prueba5'
     email_answer.email_to = 'Tony <*****@*****.**>'
     email_answer.answer_identifier = 'identifier123'
     email_answer.content_text = (
         u'Thank you for your enquiry. I am completely in favour of this measure,\n'
         u'and will certainly be voting for it.\n'
         u'Tony \n'
         u'<*****@*****.**>:')
     # There is an intended extra space after the word 'Tony'
     self.assertNotIn('<instance-', email_answer.content_text)
     self.assertNotIn('> :', email_answer.content_text)
     self.assertNotIn('Tony', email_answer.content_text)
Ejemplo n.º 8
0
 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_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)
Ejemplo n.º 10
0
    def test_class_answer(self):
        email_answer = EmailAnswer()
        self.assertTrue(hasattr(email_answer, 'subject'))
        self.assertTrue(hasattr(email_answer, '_content_text'))
        self.assertTrue(hasattr(email_answer, 'content_html'))
        self.assertTrue(hasattr(email_answer, 'answer_identifier'))
        self.assertTrue(hasattr(email_answer, 'email_from'))
        self.assertTrue(hasattr(email_answer, 'email_to'))
        self.assertTrue(hasattr(email_answer, 'when'))
        self.assertTrue(hasattr(email_answer, 'message_id'))
        email_answer.subject = 'prueba4'
        email_answer.content_text = 'prueba4lafieritaespeluda'
        email_answer.content_html = '<p>prueba4lafieritaespeluda</p>'
        email_answer.answer_identifier = '8974aabsdsfierapulgosa'
        email_answer.email_from = '*****@*****.**'
        email_answer.email_to = 'Felipe <*****@*****.**>'
        email_answer.when = 'Wed Jun 26 21:05:33 2013'
        email_answer.message_id = '<CAA5PczfGfdhf29wgK=8t6j7hm8HYsBy8Qg87iTU2pF42Ez3VcQ@mail.gmail.com>'

        self.assertTrue(email_answer)
        self.assertEquals(email_answer.subject, 'prueba4')
        self.assertEquals(email_answer.content_text,
                          'prueba4lafieritaespeluda')
        self.assertEquals(email_answer.answer_identifier,
                          '8974aabsdsfierapulgosa')
        self.assertEquals(email_answer.email_from,
                          '*****@*****.**')
        self.assertEquals(
            email_answer.email_to,
            'Felipe <*****@*****.**>')
        self.assertEquals(email_answer.when, 'Wed Jun 26 21:05:33 2013')
        self.assertEquals(
            email_answer.message_id,
            '<CAA5PczfGfdhf29wgK=8t6j7hm8HYsBy8Qg87iTU2pF42Ez3VcQ@mail.gmail.com>'
        )
        self.assertEquals(email_answer.content_html,
                          '<p>prueba4lafieritaespeluda</p>')
Ejemplo n.º 11
0
 def test_email_answer_save(self):
     email_answer = EmailAnswer()
     email_answer.subject = 'prueba4'
     outbound_identifier = self.message.outbound_identifiers.get(
         person=self.candidate1)
     email_answer.answer_identifier = outbound_identifier.key
     email_answer.content_text = 'Hola Hola esto es una prueba'
     answer = email_answer.save()
     self.assertIsInstance(answer, Answer)
     self.assertEquals(answer.message, self.message)
     self.assertEquals(answer.content, email_answer.content_text)
Ejemplo n.º 12
0
 def test_it_doesnt_contain_anything_of_the_original_email(self):
     '''If I set the "To" header in the email and use it in the email_answer.recipient
     then I should not be getting her/his email address in the content'''
     email_answer = EmailAnswer()
     email_answer.subject = 'prueba5'
     email_answer.email_to = 'Tony <*****@*****.**>'
     email_answer.answer_identifier = 'identifier123'
     email_answer.content_text = (
         u'Thank you for your enquiry. I am completely in favour of this measure,\n'
         u'and will certainly be voting for it.\n'
         u'Tony \n'
         u'<*****@*****.**>:')
     # There is an intended extra space after the word 'Tony'
     self.assertNotIn('<instance-', email_answer.content_text)
     self.assertNotIn('> :', email_answer.content_text)
     self.assertNotIn('Tony', email_answer.content_text)