[MERGE] hr_recruitment: improve test code coverage

bzr revid: rco@openerp.com-20111215101535-6p0m6v9s04z5msfz
This commit is contained in:
Raphael Collet
2011-12-15 11:15:35 +01:00
2 changed files with 61 additions and 12 deletions
-4
View File
@@ -184,10 +184,6 @@ class hr_applicant(crm.crm_case, osv.osv):
'user_email': fields.related('user_id', 'user_email', type='char', string='User Email', readonly=True),
}
def _get_stage(self, cr, uid, context=None):
ids = self.pool.get('hr.recruitment.stage').search(cr, uid, [], context=context)
return ids and ids[0] or False
_defaults = {
'active': lambda *a: 1,
'user_id': lambda self, cr, uid, context: uid,
@@ -19,27 +19,49 @@
assert applicant.name == "Application for the post of Jr.application Programmer.", "Subject does not match"
assert applicant.state == "draft"
assert len(resume_ids), "Resume does not attached."
-
I refuse applicant for the Recruitment.
-
!python {model: hr.applicant}: |
self.case_close(cr, uid, [ref("hr_case_programmer")])
-
I open applicant for the Recruitment.
-
!python {model: hr.applicant}: |
self.case_reset(cr, uid, [ref("hr_case_programmer")])
self.case_open(cr, uid, [ref("hr_case_programmer")])
-
I assign the Job position to the applicant
-
!python {model: hr.applicant}: |
self.write(cr, uid, [ref('hr_case_programmer')], {'job_id':ref('hr.job_jr_appli')})
-
I open applicant for the Recruitment
-
!python {model: hr.applicant}: |
self.case_open(cr, uid, [ref("hr_case_programmer")])
-
I start communication with applicant, first schedule phonecall.
-
!python {model: hr.recruitment.job2phonecall}: |
self.make_phonecall(cr, uid, [ref('hr_case_programmer')])
context.update({'active_model': 'hr.applicant', 'active_id': ref("hr_case_programmer"), 'active_ids': [ref("hr_case_programmer")], 'survey_id': ref("survey_job_0")})
id = self.create(cr, uid, {}, context=context)
self.make_phonecall(cr, uid, [id], context=context)
-
I schedule meeting with applicant for interview.
-
!python {model: hr.applicant}: |
self.action_makeMeeting(cr, uid, [ref('hr_case_programmer')])
-
I check Initial Qualification of applicant.
-
!python {model: hr.applicant}: |
self.stage_next(cr, uid, [ref('hr_case_programmer')])
-
I schedule First Interview of applicant.
-
!python {model: hr.applicant}: |
self.stage_next(cr, uid, [ref('hr_case_programmer')])
-
On a successful First Interview of applicant, I schedule Second Interview.
-
!python {model: hr.applicant}: |
self.stage_next(cr, uid, [ref('hr_case_programmer')])
-
Applicant fillup the answer of the interview quetion.
-
@@ -56,7 +78,13 @@
!python {model: hr.applicant}: |
self.action_print_survey(cr, uid, [ref('hr_case_programmer')])
-
On a successful interview with the applicant, I hired employee.
On a successful Second Interview of applicant Contract is Proposed to applicant.
-
!python {model: hr.applicant}: |
self.stage_next(cr, uid, [ref('hr_case_programmer')])
self.stage_previous(cr, uid, [ref('hr_case_programmer')])
-
I Hired Applicant.
-
!python {model: hr.applicant}: |
self.case_close_with_emp(cr, uid, [ref('hr_case_programmer')])
@@ -65,3 +93,28 @@
-
!assert {model: hr.applicant, id: hr_case_programmer}:
- state == 'done'
-
I do not give employment to the hired the applicant.
-
!python {model: hired.employee}: |
context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
emp_id = self.create(cr, uid, {}, context=context)
self.case_close(cr, uid, [emp_id], context=context)
-
Now I give employment to hired applicant .
-
!python {model: hr.applicant}: |
hired_emp_obj = self.pool.get('hired.employee')
self.case_reset(cr, uid, [ref("hr_case_programmer")])
self.case_open(cr, uid, [ref("hr_case_programmer")])
context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
emp_hr_id = hired_emp_obj.create(cr, uid, {}, context=context)
hired_emp_obj.case_close_with_emp(cr, uid, [emp_hr_id], context=context)
-
Now hired employee want to be a partner of company.
-
!record {model: hr.recruitment.partner.create, id: hr_recruitment_partner_id1 }:
-
!python {model: hr.recruitment.partner.create}: |
context.update({'active_model': 'hr.applicant', 'active_ids': [ref("hr_recruitment.hr_case_programmer")], 'active_id': ref("hr_recruitment.hr_case_programmer")})
self.make_order(cr, uid, [ref("hr_recruitment_partner_id1")], context=context)