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.

51 lines
2.0 KiB

  1. # Copyright 2018 Ivan Yelizariev <https://it-projects.info/team/yelizariev>
  2. # Copyright 2018 Artyom Losev <https://it-projects.info/team/ArtyomLosev>
  3. # Copyright 2019 Kolushov Alexandr <https://it-projects.info/team/KolushovAlexandr>
  4. # License LGPL-3.0 (https://www.gnu.org/licenses/lgpl.html).
  5. import odoo.tests
  6. from werkzeug import url_encode
  7. @odoo.tests.common.at_install(True)
  8. @odoo.tests.common.post_install(True)
  9. class TestUi(odoo.tests.HttpCase):
  10. def test_01_mail_to(self):
  11. # checks the presence of an element with a link to the recipient
  12. env = self.env
  13. # needed because tests are run before the module is marked as
  14. # installed. In js web will only load qweb coming from modules
  15. # that are returned by the backend in module_boot. Without
  16. # this you end up with js, css but no qweb.
  17. env["ir.module.module"].search(
  18. [("name", "=", "mail_to")], limit=1
  19. ).state = "installed"
  20. # Handle messages in Odoo
  21. res_users_ids = env["res.users"].search([])
  22. res_users_ids.write({"notification_type": "inbox"})
  23. # demo messages
  24. partner_ids = env["res.partner"].search([])
  25. msg = env["mail.message"].create(
  26. {
  27. "subject": "_Test",
  28. "body": self._testMethodName,
  29. "subtype_id": self.ref("mail.mt_comment"),
  30. "model": "mail.channel",
  31. "partner_ids": [(6, 0, [i.id for i in partner_ids])],
  32. }
  33. )
  34. # notifications for everyone
  35. for p in partner_ids.ids:
  36. env["mail.notification"].create(
  37. {"res_partner_id": p, "mail_message_id": msg.id, "is_read": False}
  38. )
  39. link = "/web#%s" % url_encode({"action": "mail.action_discuss"})
  40. self.phantom_js(
  41. link,
  42. "odoo.__DEBUG__.services['web_tour.tour'].run('mail_to_tour', 1000);",
  43. "odoo.__DEBUG__.services['web_tour.tour'].tours.mail_to_tour.ready",
  44. login="admin",
  45. )