[IMP] hr_recruitment: improve yml test process to check attachment in email after...
[odoo/odoo.git] / addons / hr_recruitment / test / recruitment_process.yml
1 -
2   In Order to test process of Recruitment,
3 -
4   Applicant interested in job position. so He send resume by email.
5 -
6   !python {model: mail.thread}: |
7     import addons
8     request_file = open(addons.get_module_resource('hr_recruitment','test', 'resume.eml'),'rb')
9     request_message = request_file.read()
10     self.message_process(cr, uid, 'hr.applicant', request_message)
11 -
12   After getting the mail, I check details of new applicant.
13 -
14   !python {model: hr.applicant}: |
15     applicant_ids = self.search(cr, uid, [('email_from','=', 'Mr. Richard Anderson <Richard_Anderson@yahoo.com>')])
16     assert applicant_ids, "Applicant is not created after getting the mail"
17     applicant = self.browse(cr, uid, applicant_ids[0], context=context)
18     resume_ids = self.pool.get('ir.attachment').search(cr, uid, [('datas_fname','=','resume.doc'),('res_model','=',self._name),('res_id','=',applicant.id)])
19     assert applicant.name == "Application for the post of Jr.application Programmer.", "Subject does not match"
20     assert applicant.state == "draft"
21     assert len(resume_ids), "Resume does not attached."
22 -
23   I assign the Job position to the applicant
24 -
25   !python {model: hr.applicant}: |
26     self.write(cr, uid, [ref('hr_case_programmer')], {'job_id':ref('hr.job_jr_appli')})
27 -
28   I open applicant for the Recruitment
29 -
30
31   !python {model: hr.applicant}: |
32     self.case_open(cr, uid, [ref("hr_case_programmer")])
33 -
34   I start communication with applicant, first schedule phonecall.
35 -
36   !python {model: hr.recruitment.job2phonecall}: |
37      self.make_phonecall(cr, uid, [ref('hr_case_programmer')])
38 -
39   I schedule meeting with applicant for interview.
40 -
41   !python {model: hr.applicant}: |
42      self.action_makeMeeting(cr, uid, [ref('hr_case_programmer')])
43 -
44   Applicant fillup the answer of the interview quetion.
45 -
46   !python {model: survey.question.wiz}: |
47     ctx = context.copy()
48     ctx.update({'active_model': 'hr.applicant', 'active_id': ref("hr_case_programmer"), 'active_ids': [ref("hr_case_programmer")], 'survey_id': ref("survey_job_0")})
49     self.fields_view_get(cr, uid, ref("survey.view_survey_question_message"),"form", context=ctx)
50     vals = self.default_get(cr, uid , [], context=ctx)
51     self.create(cr, uid, vals, context=ctx)
52     self.action_new_page(cr, uid, [ref("survey_job_0")], context=ctx)
53 -
54   I print Applicant fill up the interview quetion
55 -
56   !python {model: hr.applicant}: |
57     self.action_print_survey(cr, uid, [ref('hr_case_programmer')])
58 -
59   On a successful interview with the applicant, I hired employee.
60 -
61   !python {model: hr.applicant}: |
62      self.case_close(cr, uid, [ref('hr_case_programmer')])
63 -
64   I check that applicant is "Hired".
65 -
66   !assert {model: hr.applicant, id: hr_case_programmer}:
67     - state == 'done'