From afc57b31cda1454894b2ab88c8deea880ba72f3d Mon Sep 17 00:00:00 2001 From: "Harry (OpenERP)" Date: Tue, 25 Oct 2011 14:41:25 +0530 Subject: [PATCH] [IMP] crm_helpdesk: clean test case bzr revid: hmo@tinyerp.com-20111025091125-pnxg7bdiqb5l3lfn --- addons/crm_claim/test/customer_claim.eml | 2 +- .../test/customer_fundraising.eml | 2 +- .../crm_helpdesk/test/customer_question.eml | 15 +++++++++ .../crm_helpdesk/test/process/help-desk.yml | 33 +++++++++++-------- 4 files changed, 36 insertions(+), 16 deletions(-) create mode 100644 addons/crm_helpdesk/test/customer_question.eml diff --git a/addons/crm_claim/test/customer_claim.eml b/addons/crm_claim/test/customer_claim.eml index 7324a3b8eef..ff3c45b9142 100644 --- a/addons/crm_claim/test/customer_claim.eml +++ b/addons/crm_claim/test/customer_claim.eml @@ -3,7 +3,7 @@ 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 +To: claims@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 diff --git a/addons/crm_fundraising/test/customer_fundraising.eml b/addons/crm_fundraising/test/customer_fundraising.eml index e1bdf291e71..e7cd3f9482e 100644 --- a/addons/crm_fundraising/test/customer_fundraising.eml +++ b/addons/crm_fundraising/test/customer_fundraising.eml @@ -3,7 +3,7 @@ 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 +To: contribute@my.com Subject: Demande de controbute dans votre fonds. Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit diff --git a/addons/crm_helpdesk/test/customer_question.eml b/addons/crm_helpdesk/test/customer_question.eml new file mode 100644 index 00000000000..38a4c95fb0c --- /dev/null +++ b/addons/crm_helpdesk/test/customer_question.eml @@ -0,0 +1,15 @@ +Message-ID: <4EA66F25.7080013@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: info@my.com +Subject: Where is download link of user manual of your product ? +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 8bit + +I want to download user manual of your product. +can you provide download link? + +Thanks + diff --git a/addons/crm_helpdesk/test/process/help-desk.yml b/addons/crm_helpdesk/test/process/help-desk.yml index 687238ab269..250cb9e5dc2 100644 --- a/addons/crm_helpdesk/test/process/help-desk.yml +++ b/addons/crm_helpdesk/test/process/help-desk.yml @@ -1,17 +1,22 @@ - - I start by create helpdesk request regarding some functional questions, - so first create message manually regarding functional question for helpdesk - and test it, open this helpdesk and update that message accordingly, after - i complete this helpdesk then close it. + Customer has Questions regarding our service. so He sent questions list by email. +- + 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_helpdesk','test', 'customer_question.eml'),'rb') + request_message = request_file.read() + self.message_process(cr, uid, 'crm.helpdesk', request_message) + +- + After getting the mail, I check details of new question of that customer. - !python {model: crm.helpdesk}: | - msg = {'subject': 'Functional questions', 'body_text': 'How the CRM working?', 'from': 'admin@openerp.com'} - helpdesk_id = self.message_new(cr, uid, msg, context=None) - data = self.browse(cr, uid ,helpdesk_id) - assert data.name == "Functional questions", "Subject name is incorrect" - assert data.email_from == "admin@openerp.com","Email Id incorrect" - assert data.description == "How the CRM working?", "Description is incorrect" - self.case_open(cr, uid, [helpdesk_id]) - msg = {'subject': 'Email regarding to CRM', 'body_text': 'Details of CRM Documentation', 'from': 'admin@openerp.com'} - self.message_update(cr, uid,[helpdesk_id], msg, default_act = 'pending',context=None) - self.case_close(cr, uid, [helpdesk_id]) \ No newline at end of file + from openerp import tools + question_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right ')]) + assert question_ids and len(question_ids), "Question is not created after getting request" + question = self.browse(cr, uid, question_ids[0], context=context) + assert question.name == tools.ustr("Where is download link of user manual of your product ? "), "Subject does not match" + +