Skip to content

Commit

Permalink
Merge PR OCA#666 into 12.0
Browse files Browse the repository at this point in the history
Signed-off-by alexey-pelykh
  • Loading branch information
OCA-git-bot committed Aug 29, 2019
2 parents 42c04ef + c934f3e commit fa71f7d
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions hr_employee_service/tests/test_hr_employee_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
from odoo.tests import common

from dateutil.relativedelta import relativedelta
from datetime import date
from mock import patch


class TestHrEmployeeService(common.TransactionCase):
Expand Down Expand Up @@ -51,19 +53,22 @@ def test_2(self):
self.assertEqual(employee.service_duration_days, 0)

def test_3(self):
mocked_today = date(2019, 8, 27)
employee = self.SudoEmployee.create({
'name': 'Employee #3',
'service_hire_date': (
self.today - relativedelta(months=6)
mocked_today - relativedelta(months=6)
),
'service_start_date': (
self.today - relativedelta(months=6)
mocked_today - relativedelta(months=6)
),
})

self.assertEqual(employee.service_duration_years, 0)
self.assertEqual(employee.service_duration_months, 6)
self.assertEqual(employee.service_duration_days, 0)
with patch('odoo.fields.Date.today') as today:
today.return_value = mocked_today
self.assertEqual(employee.service_duration_years, 0)
self.assertEqual(employee.service_duration_months, 6)
self.assertEqual(employee.service_duration_days, 0)

def test_4(self):
employee = self.SudoEmployee.create({
Expand Down

0 comments on commit fa71f7d

Please sign in to comment.