Exemple #1
0
 def test_conversation_initiate_by_email_failing(self):
     # generate initial message
     msg = mailbox_models.Message(
         from_header=self.gestalt.user.email,
         body='Delivered-To: not-existing@localhost\n\nText A')
     # send signal like getmail would
     mailbox_signals.message_received.send(self, message=msg)
     self.assertEqual(len(mail.outbox), 1)
Exemple #2
0
 def test_conversation_initiate_by_email(self):
     # generate initial message
     msg = mailbox_models.Message(
             from_header=self.gestalt.user.email,
             body='Delivered-To: {}@localhost\n\nText A'.format(self.group.slug))
     # send signal like getmail would
     mailbox_signals.message_received.send(self, message=msg)
     self.assertExists(
             models.Contribution, conversation__associations__group=self.group,
             text__text='Text A')
Exemple #3
0
 def test_texts_reply_by_email_mailbox(self):
     # send message to other_gestalt via web interface
     self.client.post(
             self.get_url('create-gestalt-conversation', self.other_gestalt.pk),
             {'subject': 'Subject A', 'text': 'Text A'})
     text_a = self.assertExists(models.Contribution, conversation__subject='Subject A')
     self.assertNotificationSent()
     # generate reply message
     reply_to = mail.outbox[0].extra_headers['Reply-To']
     msg = mailbox_models.Message(
             from_header=self.other_gestalt.user.email,
             body='Delivered-To: {}\n\nText B'.format(reply_to))
     # send signal like getmail would
     mailbox_signals.message_received.send(self, message=msg)
     self.assertExists(
             models.Contribution, conversation=text_a.conversation.get(),
             text__text='Text B')
Exemple #4
0
 def test_content_reply_by_email_mailbox(self):
     # create article
     self.client.post(
             reverse('create-group-article', args=(self.group.slug,)),
             {'title': 'Test', 'text': 'Test'})
     a = self.assertExists(associations.Association, content__title='Test')
     self.assertNotificationSent()
     # generate reply message
     reply_to = mail.outbox[0].extra_headers['Reply-To']
     msg = mailbox_models.Message(
             from_header=self.gestalt.user.email,
             body='Delivered-To: {}\n\nText B'.format(reply_to))
     # send signal like getmail would
     mailbox_signals.message_received.send(self, message=msg)
     self.assertFalse(models.Contribution.objects.filter(
         content=a.content.get(), text__text='Text B').exists())
     self.assertTrue(models.Contribution.objects_with_internal.filter(
         content=a.content.get(), text__text='Text B').exists())