[MERGE] Merged with trunk addons.
[odoo/odoo.git] / addons / crm_claim / test / process / claim.yml
1 -
2   Customer requests a claim after the sale of our product. He sends claim request by email.
3 -
4   Mail script will be fetched him request from mail server. so I process that mail after read EML file 
5 -
6   !python {model: mail.thread}: |
7     import addons
8     request_file = open(addons.get_module_resource('crm_claim','test', 'customer_claim.eml'),'rb')
9     request_message = request_file.read()
10     self.message_process(cr, uid, 'crm.claim', request_message)
11 -
12   After getting the mail, I check details of new claim of that customer.
13 -
14   !python {model: crm.claim}: |
15     from openerp import tools
16     claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')])
17     assert claim_ids and len(claim_ids), "Claim is not created after getting request"
18     claim = self.browse(cr, uid, claim_ids[0], context=context)
19     assert claim.name == tools.ustr("demande derèglement de votre produit."), "Subject does not match"
20 -
21   I open customer claim.
22 -
23   !python {model: crm.claim}: |
24     claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')])
25     self.case_open(cr, uid, claim_ids)
26 -
27   I check Claim Details after open. 
28 -
29   !python {model: crm.claim}: |
30     claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')])
31     claim = self.browse(cr, uid, claim_ids[0])
32     assert claim.state == "open", "Claim is not in Open state"
33     assert claim.stage_id.id == ref("crm.stage_lead2"), "Claim is not in Qualification stage"
34 -
35   After complete all service from our side, I close this claim.
36 -
37   !python {model: crm.claim}: |
38     claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')])
39     self.case_close(cr, uid, claim_ids)
40 -
41   I check Claim details after closed.
42 -
43   !python {model: crm.claim}: |
44     claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')])
45     claim = self.browse(cr, uid, claim_ids[0])
46     assert claim.state == "done", "Claim is not in close state"