From 9db806e37203556656e2a6c71b6daef57de45b17 Mon Sep 17 00:00:00 2001 From: "Jagdish Panchal (Open ERP)" Date: Mon, 26 Dec 2011 14:55:16 +0530 Subject: [PATCH] [IMP] hr_attendance: improve test case bzr revid: jap@tinyerp.com-20111226092516-lb6d3k3osn7tmr3z --- .../hr_attendance/test/attendance_process.yml | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/addons/hr_attendance/test/attendance_process.yml b/addons/hr_attendance/test/attendance_process.yml index 5e3c877020d..25eb0cc05c0 100644 --- a/addons/hr_attendance/test/attendance_process.yml +++ b/addons/hr_attendance/test/attendance_process.yml @@ -1,36 +1,32 @@ - - In order to test attendance process in OpenERP, at the time of login, I use "Sign In/Sign Out" wizard for attendances. + In order to test attendance process in OpenERP, I perform SignIn/SignOut for an employee. - !record {model: hr.sign.in.out, id: employee_sign_in}: emp_id: hr.employee3 state: absent - - I click on "Sign In" button of this wizard. + Employee Signs In. - !python {model: hr.sign.in.out}: | import time from datetime import datetime, date, timedelta - employee = self.pool.get('hr.employee').read(cr, uid, [ref('hr.employee3')])[0] + employee = self.pool.get('hr.employee').read(cr, uid, ref('hr.employee3')) self.write(cr, uid, [ref('employee_sign_in')], {'name': employee['name'], 'state': employee['state'], 'emp_id': employee['id']}) self.si_check(cr, uid, [ref("employee_sign_in")]) - attendance_obj = self.pool.get('hr.attendance') - attendance_id = attendance_obj.search(cr, uid, [('employee_id', '=', "Antoine Philippe")]) - date = (datetime.now()+timedelta(seconds=-20)).strftime('%Y-%m-%d %H:%M:%S') - attendance_obj.write(cr, uid, attendance_id ,{'name': date}) - I check that Employee is "Present". - !assert {model: hr.employee, id: hr.employee3, severity: error, string: Employee should be in present state}: - state == 'present' - - I click on "Sign out" button of this wizard. + After few seconds, employee sign's out. - !python {model: hr.sign.in.out}: | - employee = self.pool.get('hr.employee').read(cr, uid, [ref('hr.employee3')])[0] - self.write(cr, uid, [ref('employee_sign_in')], {'name': employee['name'], 'state': employee['state'], 'emp_id': employee['id']}) + import time + time.sleep(2) self.so_check(cr, uid, [ref("employee_sign_in")]) - - I check that Employee is "absent". + I check that Employee is "Absent". - - !assert {model: hr.employee, id: hr.employee3, severity: error, string: Employee should be in present state}: + !assert {model: hr.employee, id: hr.employee3, severity: error, string: Employee should be in absent state}: - state == 'absent' \ No newline at end of file