[MERGE] hr_attendance: improve yml tests

bzr revid: rco@openerp.com-20120104133024-6md4e3tjfs2qi53z
This commit is contained in:
Raphael Collet 2012-01-04 14:30:24 +01:00
commit 93bcc2528d
1 changed files with 17 additions and 36 deletions

View File

@ -1,50 +1,31 @@
-
In order to test attendance process in OpenERP, at the time of login, I use "Sign In/Sign Out" wizard for attendances.
I click on this wizard to login.
In order to test attendance process in OpenERP, I entry of SignIn of employee.
-
!python {model: hr.sign.in.out}: |
hr_employee = self.pool.get('hr.employee')
uid = ref('base.user_al')
emp_ids = hr_employee.search(cr, uid, [('user_id', '=', uid)])
if emp_ids:
employee = hr_employee.browse(cr, uid, emp_ids)[0]
id = self.create(cr, uid, {'emp_id': employee.id, 'name': employee.name, 'state': employee.state})
self.si_check(cr, uid, [id])
context.update({'emp_id': [ref('hr.employee_al')]}) #TOFIX: emp_ids instead of 'emp_id'
-
!record {model: hr.sign.in.out, id: employee_sign_in}:
{}
-
Employee Signs In.
-
!python {model: hr.sign.in.out}: |
self.si_check(cr, uid, [ref("employee_sign_in")], context=context)
-
I check that Employee is "Present".
-
!assert {model: hr.employee, id: hr.employee_al, severity: error, string: Employee should be in present state}:
- state == 'present'
-
I click on "Sign In" button of this wizard, this will Open a new form which ask for Last Sign Out date.
After few seconds, employee sign's out.
-
!python {model: hr.sign.in.out}: |
hr_employee = self.pool.get('hr.employee')
uid = ref('base.user_al')
emp_ids = hr_employee.search(cr, uid, [('user_id', '=', uid)])
if emp_ids:
employee = hr_employee.browse(cr, uid, emp_ids)[0]
id = self.create(cr, uid, {'emp_id': employee.id, 'name': employee.name, 'state': employee.state})
self.si_check(cr, uid, [id])
-
I select Last Sign Out date.
-
!record {model: hr.sign.in.out.ask, id: hr_sign_in_out_ask_Antony}:
last_time: !eval time.strftime('%Y-%m-%d %H:%M:%S')
name: Antony
-
Now I click on "Sign In" button of this wizard.
-
!python {model: hr.sign.in.out.ask}: |
import time
hr_employee = self.pool.get('hr.employee')
uid = ref('base.user_al')
emp_ids = hr_employee.search(cr, uid, [('user_id', '=', uid)])
if emp_ids:
employee = hr_employee.browse(cr, uid, emp_ids)[0]
id = self.create(cr, uid, {'emp_id': employee.id, 'name': employee.name, 'last_time': time.strftime('%Y-%m-%d %H:%M:%S')})
time.sleep(2)
self.so_check(cr, uid, [ref("employee_sign_in")], context=context)
-
Finally i check the employee is present.
I check that Employee is "Absent".
-
!assert {model: hr.employee, id: hr.employee_al, severity: error, string: Employee should be in present state}:
- state == 'present'
!assert {model: hr.employee, id: hr.employee_al, severity: error, string: Employee should be in absent state}:
- state == 'absent'