2 Set the current user as portal user.
5 'uid': 'portal.demo_user0'
7 As a portal user, I fill in the contact form and submit it.
9 !record {model: portal_crm.crm_contact_us, id: contact_us_01}:
10 name: 'Need information about your contact form module'
11 partner_name: 'Mr. John Doe'
12 email_from: 'mister@john.doe'
13 phone: '+32 444 11 22 33'
14 description: 'Dear Sir or Madam, could you get back to me asap ? Regards.'
16 For security reasons, the wizard values is empty.
18 !python {model: portal_crm.crm_contact_us}: |
19 obj = self.browse(cr, uid, ref("contact_us_01"))
20 assert not(obj.name or obj.partner_name or obj.email_from or obj.phone or obj.description), 'All the wizard\'s values are not empty'
22 And a lead is created with the proper values.
24 !python {model: crm.lead}: |
25 from openerp import SUPERUSER_ID
27 ids = self.search(cr, SUPERUSER_ID, [('name', '=', 'Need information about your contact form module')])
28 assert len(ids) == 1, 'There are more than one matching lead, while only one was expected'
30 obj = self.browse(cr, SUPERUSER_ID, ids[0])
31 expected_values = dict(
32 name='Need information about your contact form module',
33 partner_name='Mr. John Doe',
34 email_from='mister@john.doe',
35 phone='+32 444 11 22 33',
36 description='Dear Sir or Madam, could you get back to me asap ? Regards.')
37 for k, v in expected_values.iteritems():
38 assert obj[k] == expected_values[k], 'Lead data mismatch: expected %s, got %s' % (expected_values[k], obj[k])