diff options
| author | Jairo Llopis <yajo.sk8@gmail.com> | 2015-09-23 18:23:07 +0200 |
|---|---|---|
| committer | Nicolas Martinelli <nim@odoo.com> | 2015-09-29 15:27:46 +0200 |
| commit | 68eaeb684d34aa2ada16e89eac623cfdda294b14 (patch) | |
| tree | 435e7ec46a1fe7cd6d19a8c76b87f8f779cfa1f9 /addons/crm/tests | |
| parent | ffa28488bed9e5d259d45c6737673a886c09270f (diff) | |
[ADD] crm: test user notification
Test if the user gets notified for incoming contact requests.
Diffstat (limited to 'addons/crm/tests')
| -rw-r--r-- | addons/crm/tests/__init__.py | 3 | ||||
| -rw-r--r-- | addons/crm/tests/test_new_lead_notification.py | 34 |
2 files changed, 37 insertions, 0 deletions
diff --git a/addons/crm/tests/__init__.py b/addons/crm/tests/__init__.py new file mode 100644 index 00000000000..69d299aea81 --- /dev/null +++ b/addons/crm/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +import test_new_lead_notification diff --git a/addons/crm/tests/test_new_lead_notification.py b/addons/crm/tests/test_new_lead_notification.py new file mode 100644 index 00000000000..603889b2bc5 --- /dev/null +++ b/addons/crm/tests/test_new_lead_notification.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +from openerp.tests.common import TransactionCase + + +class NewLeadNotificationTest(TransactionCase): + def test_new_lead_notification(self): + # Create a new user + user = self.env["res.users"].create({ + "name": __file__, + "login": __file__, + }) + + # Subscribe him to sales department + team = self.env.ref("sales_team.section_sales_department") + subtype = self.env.ref("crm.mt_salesteam_lead") + team.sudo(user).message_subscribe_users(subtype_ids=[subtype.id]) + + # Imitate what happens in the controller when somebody creates a new + # lead from the website form + lead = (self.env["crm.lead"] + .with_context(mail_create_nosubscribe=True) + .sudo() + .create({"contact_name": "Somebody", + "description": "Some question", + "email_from": "somemail@example.com", + "name": "Some subject", + "partner_name": "Some company", + "section_id": self.env.ref( + "sales_team.section_sales_department").id, + "phone": "+0000000000"})) + + # The user should have a new unread message + self.assertTrue(lead.sudo(user).message_unread) |
