You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1 KiB

  1. # Copyright 2017-18 Eficent Business and IT Consulting Services S.L.
  2. # (www.eficent.com)
  3. # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
  4. from odoo.addons.mail.tests.common import TestMail
  5. from odoo.addons.mail.tests.test_mail_gateway import MAIL_TEMPLATE
  6. class TestFetchmailIncomingLog(TestMail):
  7. def setUp(self):
  8. super(TestFetchmailIncomingLog, self).setUp()
  9. self.fetchmail_server = self.env['fetchmail.server'].create({
  10. 'name': 'Test Fetchmail Server',
  11. 'type': 'imap',
  12. })
  13. def test_message_process(self):
  14. email_from = 'test1@example.com'
  15. to_email = 'test2@example.com'
  16. msg_id = 'Test log message to process'
  17. with self.assertRaises(ValueError):
  18. mail = MAIL_TEMPLATE.format(
  19. to=to_email,
  20. email_from=email_from,
  21. cc='',
  22. subject='testing',
  23. extra='',
  24. msg_id=msg_id,
  25. )
  26. self.env['mail.thread'].with_context({
  27. 'fetchmail_server_id': self.fetchmail_server.id,
  28. }).message_process(None, mail)