def test_forward_email(self):
    'Test forward form.'
    url = '{}?action=forward&mbox=INBOX&mailid=46932'.format(reverse('modoboa_webmail:index'))
    session = self.client.session
    session['lastaction'] = 'compose'
    session.save()
    with self.settings(MEDIA_ROOT=self.workdir):
        response = self.client.get(url, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
    response = response.json()
    self.assertIn('id="id_origmsgid"', response['listing'])
    self.assertEqual(len(self.client.session['compose_mail']['attachments']), 1)
    response = self.client.post(url, {'from_': self.user.email, 'to': 'example@example.com', 'subject': 'test', 'body': 'Test', 'origmsgid': '<id@localhost>'})
    self.assertEqual(len(mail.outbox), 1)
Test forward form.
def test_forward_email(self):
    
    url = '{}?action=forward&mbox=INBOX&mailid=46932'.format(reverse('modoboa_webmail:index'))
    session = self.client.session
    session['lastaction'] = 'compose'
    session.save()
    with self.settings(MEDIA_ROOT=self.workdir):
        response = self.client.get(url, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
    response = response.json()
    self.assertIn('id="id_origmsgid"', response['listing'])
    self.assertEqual(len(self.client.session['compose_mail']['attachments']), 1)
    response = self.client.post(url, {'from_': self.user.email, 'to': 'example@example.com', 'subject': 'test', 'body': 'Test', 'origmsgid': '<id@localhost>'})
    self.assertEqual(len(mail.outbox), 1)