Skip to content

Commit 5dda09b

Browse files
committed
hr_recruitment_phone: add unit test
1 parent d410659 commit 5dda09b

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
This module validate phone numbers in the Applicant form of the *Recruitment* module, just like the
1+
This module validates phone numbers in the Applicant form of the *Recruitment* module, just like the
22
*phone_validation* module valide phone numbers in the Partner form. It also adds phone number lookup on applicants on incoming calls.
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import test_phone
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Copyright 2021 Akretion France (http://www.akretion.com/)
2+
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4+
5+
from odoo.tests.common import TransactionCase
6+
7+
8+
class TestRecruitmentPhone(TransactionCase):
9+
def setUp(self):
10+
super().setUp()
11+
self.fr_country_id = self.env.ref("base.fr").id
12+
self.phco = self.env["phone.common"]
13+
self.env.company.write({"country_id": self.fr_country_id})
14+
self.test_record = self.env["hr.applicant"].create(
15+
{
16+
"name": "Expert Odoo",
17+
"partner_name": "Alexis de Lattre",
18+
"partner_phone": "+33 4 78 52 52 52",
19+
}
20+
)
21+
22+
def test_lookup(self):
23+
res = self.phco.get_record_from_phone_number("0478525252")
24+
self.assertIsInstance(res, tuple)
25+
self.assertEqual(res[0], "hr.applicant")
26+
self.assertEqual(res[1], self.test_record.id)
27+
self.assertEqual(
28+
res[2], self.test_record.with_context(callerid=True).name_get()[0][1]
29+
)

0 commit comments

Comments
 (0)