[IMP] crm_helpdesk: clean test case

bzr revid: hmo@tinyerp.com-20111025091125-pnxg7bdiqb5l3lfn
This commit is contained in:
Harry (OpenERP) 2011-10-25 14:41:25 +05:30
parent 793505e379
commit afc57b31cd
4 changed files with 36 additions and 16 deletions

View File

@ -3,7 +3,7 @@ Date: Tue, 25 Oct 2011 13:41:17 +0530
From: Mr. John Right <info@customer.com>
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

View File

@ -3,7 +3,7 @@ Date: Tue, 25 Oct 2011 13:41:17 +0530
From: Mr. John Right <info@customer.com>
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

View File

@ -0,0 +1,15 @@
Message-ID: <4EA66F25.7080013@customer.com>
Date: Tue, 25 Oct 2011 13:41:17 +0530
From: Mr. John Right <info@customer.com>
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

View File

@ -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])
from openerp import tools
question_ids = self.search(cr, uid, [('email_from','=', 'Mr. John Right <info@customer.com>')])
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"