Files
odoo_source/addons/project_timesheet/test/work_timesheet.yml
T
Nicolas Lempereur a5e32690b0 [FIX] tests: UTC used in test when it should not
The test for account followup use UTC time, but the default `date_maturity`
and `date_due` of an account invoice come from fields.Date.context_today`.

One failing test for project_timesheet also used `today` instead of
`context_today`.

So depending on the test user timezone, an error of one day (if UTC time
and user time are on different day) occured which failed the tests.

For example:

* user has GMT+1 timezone, test fails 0:00am–1:00am (11:00pm-0:00am in UTC)
* user has GMT+3 timezone, test fails 0:00am–3:00am (9:00pm-0:00am in UTC)

This fix removes UTC use in the tests.
2015-03-10 17:33:43 +01:00

23 lines
962 B
YAML

-
I set task work entry for Employee
-
!record {model: project.task.work, id: project_task_work1}:
date: !eval time.strftime('%Y-%m-%d %H:%M:%S')
name: Test Timesheet records
task_id: project.project_task_10
hours: 20.0
user_id: base.user_demo
company_id: base.main_company
-
I check Timesheet line for employee in current Timesheet
-
!python {model: hr.analytic.timesheet}: |
from openerp.osv import fields
start = fields.date.context_today(self, cr, uid, context=context)
task_work = self.search(cr, uid, [("name","=","Social network integration: Test Timesheet records")],context)[0]
task_ids = self.browse(cr, uid, task_work, context)
assert task_ids.user_id.id == ref("base.user_demo"), 'Error, The User in Timesheet is not Correct'
assert task_ids.date == start, 'Error, The Date in Timesheet is not ok'
assert task_ids.product_uom_id.name == "Hour(s)", 'Error, The Hour in Timesheet is not ok'