summaryrefslogtreecommitdiff
path: root/addons/test_mail/tests/test_message_post.py
AgeCommit message (Collapse)Author
2021-04-08[IMP] event, mail, mass_mailing, sms, test_mail: clean some mail tests tools ↵Thibault Delavallée
helpers and parameters In this commit we backport some of 14.1+ improvements done in mail tools in order to keep a coherent definition through sub versions. We also improve docstring and add some explanations on available toold and asserts. Task ID-2500615 COM PR odoo/odoo#68874
2021-01-06[FIX] mail: send notification mail with right access link when using mail.threadAchraf (abz)
PURPOSE Notification may be sent using a generic mail.thread record, notably when sending user notifications. In that case links to view document are incorrect. HOW TO REPRODUCE Issue - Install "Approvals" - Submit new approval with you as "Request Owner" - Click on "View Approval Request" in your mailbox The link redirects to a 505 error Cause The model is not the correct one and the res_id is undefined Solution Specify the model and the res_id to _notify_get_action_link when creating the link with kwargs SPECIFICATIONS Propagate message value through various notification sub methods. That way we can rely on them if model seems void. Also limit values given as URL parameters to some white listed values. LINKS opw-2358846 Task ID-2379766 Followup of odoo/odoo#60998 Followup of odoo/odoo#61545 Closes odoo/odoo#63292 Closes odoo/enterprise#15585 closes odoo/odoo#64170 X-original-commit: 2b6d2b71f6c60bcf64db440473c88d1dc335acbf Related: odoo/enterprise#15588 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> Co-authored-by: Achraf Ben Azzouz <abz@odoo.com> Co-authored-by: Thibault Delavallée <tde@odoo.com>
2020-11-12[REV][FIX] mail: Send mail with correct access linkThibault Delavallée
This reverts commit fbd30f4266d86b53aa4b13b72a93bccee0d7eb69. Indeed kwargs are used to build a link, meaning message value are given to some links when using message_notify. A better fix will be provided soon. Reverting to avoid issues in stable. closes odoo/odoo#61604 X-original-commit: a5362345d51cfddf4e34f64a30238395f4453eb3 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-11-06[FIX] mail: Send mail with correct access linkAchraf (abz)
Issue - Install "Approvals" - Submit new approval with you as "Request Owner" - Click on "View Approval Request" in your mailbox The link redirects to a 505 error Cause The model is not the correct one and the res_id is undefined Solution Specify the model and the res_id to _notify_get_action_link when creating the link with kwargs opw-2358846 closes odoo/odoo#61463 X-original-commit: bb89abb057acef57ee1a791beb661ada013ec7b9 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com> Signed-off-by: Achraf <abz-odoo@users.noreply.github.com>
2020-09-04[FIX] website_livechat: missing decorator on message_postDidier (did)
Incorrect override of message_post. Without this decorator, message_post returns a string `mail.message(ID,)` via RPC. Discuss needs the message ID to scroll chat window closes odoo/odoo#57122 X-original-commit: 3939d3aa3b60e0f606a9f7defd695417f7b3f383 Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
2020-01-23Revert "[IMP] test_mail(_full): run tests at post_install"Xavier-Do
This reverts commit 976e560a877bcaf9e769b6005d33bd49833eceb9. Even if it didn't looked like a bad idea, this need some more thinking. This new version of query count creates random failure of runbot builds. closes odoo/odoo#43820 Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
2020-01-22[IMP] test_mail(_full): run tests at post_installSébastien Theys
- take advantage of runbot multi-build capabilities - get similar result when running them locally during dev - better detect when other modules add extra queries Query counts are split in the base value (testing with just test_mail installed) + the extra modules overhead. Part of task-2178641 closes odoo/odoo#43666 Pr: #43666 Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
2019-12-02[REF] mail, various: rename subtype parameter of message_post to subtype_xmlidThibault Delavallée
PURPOSE Clean posting process and improve mail.message definition and comprehension. SPECIFICATIONS In order to be more explicit subtype parameter is renamed to subtype_xmlid. It therefore clearly indicates it should be a valid subtype Xml ID. Support of ill formatted Xml IDs is removed because there is no reason to try to add some random prefix. Give something that exists or go to hell, punk ! LINKS Task ID 2071556 PR #38692
2019-11-29[FIX] mail: restrict access to mail.mail modelThibault Delavallée
From now on mail.mail is considered as a technical model. Indeed people should not really manually craft mails by hand. Instead various functional flows should either send mails, either craft mails based on some user input. We therefore make mail restricted to admin users. Flows creating mail.mail are updated to use sudo, and ensure it was done in a context that makes sense to delegate this power to the user. Task ID 1853147 PR #32243
2019-11-20[REF] test_mail: update test message post to new commonThibault Delavallée
PURPOSE Currently tools and asserts for mail tests are located inside test_mail module. It makes difficult to re-use them in apps tests or force them to write custom quick and dirty tools and asserts. SPECIFICATIONS Update tests to new tools / asserts / helpers / classes defined in mail and test_mail. Notably * ``BaseFunctionalTest`` class is replaced by the new ``TestMailCommon`` pimped one; * ``assertNotifications`` is replaced by ``assertSinglePostNotifications`` (shortcut for a simple message_post) or ``assertPostNotifications`` (complete asserts involving several messages and notifications); * correctly invoke ``mock_mail_gateway`` when mocking email sending; * replace manual check of sent emails or ``assertEmails`` by ``assertSentEmails``; * remove custom mocks / checks and replace them by now standard mocks and assertions (if any); In this commit we update: test message post LINKS Task ID 2068986 PR #38070
2019-09-17[REF] mail: remove deprecated email formataddrJulien Castiaux
[PEP 594] is going to depreciate the legacy `email.message.Message` API and its related modules. Among them the `email.utils.formataddr` function, this function takes a `(name, email)` pair and returns a string value suitable for From, To and Cc headers. The stdlib function is capable of handling several character encoding and two binary-to-ascii encoding. Odoo only uses `utf-8` which is compatible with the base64 b2a encoding. The re-implementation of that function has been simplified to only support base64-ed utf-8 and ascii. [PEP 594]: https://www.python.org/dev/peps/pep-0594/\#email-lagacy-api
2019-09-06[MOV] test_mail: move composer and post tests from template testsThibault Delavallée
PURPOSE In order to rewrite some tests, remove low-level tests and add coverage first step is to reorganize a bit test_mail content. Several tests cases are spread among several files and finding back some feature coverage tests is not easy. SPECIFICATIONS Reorganize tests, notably * put composer with template tests in with composer tests; * put post with template tests with post tests; * put tracking multi company test with tracking tests; LINKS Task 1958697
2019-09-06[MOV] test_mail: split post and composer testsThibault Delavallée
PURPOSE In order to rewrite some tests, remove low-level tests and add coverage first step is to reorganize a bit test_mail content. Several tests cases are spread among several files and finding back some feature coverage tests is not easy. SPECIFICATIONS Reorganize tests, notably * put message_post related test in test_message_post; * have only composer related test in test_message_compose(r); * put alias tests in test_mail_gateway; * move some discuss tests to post tests as they are linked to notification details, not really Discuss features. LINKS Task 1958697