From 391c3edca8e0f59f471adcaa40a638ebdfb895ce Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Tue, 25 Oct 2011 13:58:49 +0530 Subject: [PATCH] [IMP] crm_claim: clean test cases bzr revid: hmo@tinyerp.com-20111025082849-caz28c9qwcqlq2is --- addons/crm/test/ui/onchange_events.yml | 1 - addons/crm_claim/__openerp__.py | 2 +- addons/crm_claim/test/customer_claim.eml | 17 +++++++ addons/crm_claim/test/process/claim.yml | 46 +++++++++++++++---- .../{claim_form.yml => onchange_events.yml} | 10 +++- 5 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 addons/crm_claim/test/customer_claim.eml rename addons/crm_claim/test/ui/{claim_form.yml => onchange_events.yml} (54%) diff --git a/addons/crm/test/ui/onchange_events.yml b/addons/crm/test/ui/onchange_events.yml index 4f067ab0a57..7f1ef1c67a5 100644 --- a/addons/crm/test/ui/onchange_events.yml +++ b/addons/crm/test/ui/onchange_events.yml @@ -3,7 +3,6 @@ - !python {model: crm.lead}: | action = self.onchange_partner_address_id(cr, uid, ref("crm_case_qrecorp0"), ref("base.res_partner_address_notsotinysarl0"), email=False) - assert action['value']['country_id'] == 20, "Country name not True" assert action['value']['phone'] == '(+32).81.81.37.00', "phone number is wrong" - I call onchange event to change email "Opt-out" option for Lead. diff --git a/addons/crm_claim/__openerp__.py b/addons/crm_claim/__openerp__.py index 8f0aef1bf37..96a3f8ddfdf 100644 --- a/addons/crm_claim/__openerp__.py +++ b/addons/crm_claim/__openerp__.py @@ -49,7 +49,7 @@ automatically new claims based on incoming emails. 'crm_claim_demo.xml', ], 'test': ['test/process/claim.yml', - 'test/ui/claim_form.yml'], + 'test/ui/onchange_events.yml'], 'installable': True, 'active': False, 'certificate' : '00612027414703404749', diff --git a/addons/crm_claim/test/customer_claim.eml b/addons/crm_claim/test/customer_claim.eml new file mode 100644 index 00000000000..7324a3b8eef --- /dev/null +++ b/addons/crm_claim/test/customer_claim.eml @@ -0,0 +1,17 @@ +Message-ID: <4EA66F25.7080001@customer.com> +Date: Tue, 25 Oct 2011 13:41:17 +0530 +From: Mr. John Right +User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Lightning/1.0b2 Thunderbird/3.1.8 +MIME-Version: 1.0 +To: sales@my.com +Subject: demande de =?ISO-8859-1?Q?r=E8glement_de_votre_produit=2E?= +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 8bit + +J'ai acheté votre produit il ya quelques jours. maintenant certains +problèmes sont survenus sur votre produit. +je demande donc à convertir cette demande que la réclamation et de +résoudre les problèmes le plus tôt possible. + +Merci + diff --git a/addons/crm_claim/test/process/claim.yml b/addons/crm_claim/test/process/claim.yml index b12698797cb..43389726357 100644 --- a/addons/crm_claim/test/process/claim.yml +++ b/addons/crm_claim/test/process/claim.yml @@ -1,18 +1,48 @@ - - I check claim which contain customer claim information about - product related problem. + Customer claim after sale our product. so He send claim request by email. - - I make this claim as Open. + Mail script will be fetched him request from mail server. so I process that mail after read EML file +- + !python {model: mail.thread}: | + import addons + request_file = open(addons.get_module_resource('crm_claim','test', 'customer_claim.eml'),'rb') + request_message = request_file.read() + self.message_process(cr, uid, 'crm.claim', request_message) + +- + After getting the mail, I check details of new claim of that customer. - !python {model: crm.claim}: | - self.case_open(cr, uid, [ref('crm_case_claim04')]) - claim = self.browse(cr, uid, ref('crm_case_claim04')) + from openerp import tools + claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right ')]) + assert claim_ids and len(claim_ids), "Claim is not created after getting request" + claim = self.browse(cr, uid, claim_ids[0], context=context) + assert claim.name == tools.ustr("demande derèglement de votre produit."), "Subject does not match" + +- + I open customer claim. +- + !python {model: crm.claim}: | + claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right ')]) + self.case_open(cr, uid, claim_ids) +- + I check Claim Details after open. +- + !python {model: crm.claim}: | + claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right ')]) + claim = self.browse(cr, uid, claim_ids[0]) assert claim.state == "open", "Claim is not in Open state" assert claim.stage_id.id == ref("crm.stage_lead1"), "Claim is not in New stage" - - After complete all service from our side i close this claim. + After complete all service from our side, I close this claim. - !python {model: crm.claim}: | - self.case_close(cr, uid, [ref('crm_case_claim04')]) - claim = self.browse(cr, uid, ref('crm_case_claim04')) + claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right ')]) + self.case_close(cr, uid, claim_ids) +- + I check Claim details after closed +- + !python {model: crm.claim}: | + claim_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right ')]) + claim = self.browse(cr, uid, claim_ids[0]) assert claim.state == "done", "Claim is not in close state" diff --git a/addons/crm_claim/test/ui/claim_form.yml b/addons/crm_claim/test/ui/onchange_events.yml similarity index 54% rename from addons/crm_claim/test/ui/claim_form.yml rename to addons/crm_claim/test/ui/onchange_events.yml index bbf37688ed6..9068b074512 100644 --- a/addons/crm_claim/test/ui/claim_form.yml +++ b/addons/crm_claim/test/ui/onchange_events.yml @@ -1,8 +1,14 @@ - - In order to test for changes on partner, data change automatically according to partner. + I call onchange_event to change partner on claim form. - !python {model: crm.claim}: | partner_onchange = self.onchange_partner_id(cr, uid, [ref('crm_case_claim04')], ref('base.res_partner_10')) assert partner_onchange['value']['partner_phone'] == "+33-658-256545" ,"Phone number is wrong" - assert partner_onchange['value']['partner_address_id'] == 20 ,"Address is wrong" assert partner_onchange['value']['email_from'] == 'l.dupont@tecsas.fr' ,"Email address is wrong" + +- + I call onchange event to change contact details on claim form. +- + !python {model: crm.claim}: | + self.onchange_partner_address_id(cr, uid, ref('crm_case_claim04'), ref("base.res_partner_address_notsotinysarl0"), email=False) +