summaryrefslogtreecommitdiff
path: root/addons/crm_sms/tests
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/crm_sms/tests
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/crm_sms/tests')
-rw-r--r--addons/crm_sms/tests/__init__.py3
-rw-r--r--addons/crm_sms/tests/test_crm_lead.py29
2 files changed, 32 insertions, 0 deletions
diff --git a/addons/crm_sms/tests/__init__.py b/addons/crm_sms/tests/__init__.py
new file mode 100644
index 00000000..e6f86243
--- /dev/null
+++ b/addons/crm_sms/tests/__init__.py
@@ -0,0 +1,3 @@
+# -*- coding: utf-8 -*-
+
+from . import test_crm_lead
diff --git a/addons/crm_sms/tests/test_crm_lead.py b/addons/crm_sms/tests/test_crm_lead.py
new file mode 100644
index 00000000..f5659da8
--- /dev/null
+++ b/addons/crm_sms/tests/test_crm_lead.py
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo.addons.crm.tests.common import TestCrmCommon
+from odoo.tests.common import Form, users
+
+
+class TestCRMLead(TestCrmCommon):
+
+ @users('user_sales_manager')
+ def test_phone_mobile_update(self):
+ lead = self.env['crm.lead'].create({
+ 'name': 'Lead 1',
+ 'country_id': self.env.ref('base.us').id,
+ 'phone': self.test_phone_data[0],
+ })
+ self.assertEqual(lead.phone, self.test_phone_data[0])
+ self.assertFalse(lead.mobile)
+ self.assertEqual(lead.phone_sanitized, self.test_phone_data_sanitized[0])
+
+ lead.write({'phone': False, 'mobile': self.test_phone_data[1]})
+ self.assertFalse(lead.phone)
+ self.assertEqual(lead.mobile, self.test_phone_data[1])
+ self.assertEqual(lead.phone_sanitized, self.test_phone_data_sanitized[1])
+
+ lead.write({'phone': self.test_phone_data[1], 'mobile': self.test_phone_data[2]})
+ self.assertEqual(lead.phone, self.test_phone_data[1])
+ self.assertEqual(lead.mobile, self.test_phone_data[2])
+ self.assertEqual(lead.phone_sanitized, self.test_phone_data_sanitized[2])