Commit eb07d0a4 authored by Jérome Perrin's avatar Jérome Perrin

test rendering a normal form using deferred style


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@31363 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c12c649c
...@@ -115,6 +115,41 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -115,6 +115,41 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
else: else:
self.fail('Attachment not found in email') self.fail('Attachment not found in email')
def test_normal_form(self):
self.loginAsUser('bob')
# simulate a big request, for which Base_callDialogMethod will not issue a
# redirect
response = self.publish(
'/%s/person_module/pers/Base_callDialogMethod?deferred_portal_skin=%s&'
'dialog_method=Person_view&dialog_id=Person_view&'
'deferred_style:int=1&junk=%s' % (self.portal.getId(),
self.skin,
'X' * 2000),
'%s:%s' % (self.username, self.password))
transaction.commit()
self.tic()
last_message = self.portal.MailHost._last_message
self.assertNotEquals((), last_message)
mfrom, mto, message_text = last_message
self.assertEquals('"%s" <%s>' % (self.first_name, self.recipient_email_address), mto[0])
mail_message = email.message_from_string(message_text)
for part in mail_message.walk():
content_type = part.get_content_type()
file_name = part.get_filename()
# "Person" is the title of Person_view form
if file_name == 'Person%s' % self.attachment_file_extension:
self.assertEquals(content_type, self.content_type)
self.assertEquals('attachment; filename="Person%s"' %
self.attachment_file_extension,
part.get('Content-Disposition'))
data = part.get_payload(decode=True)
error_list = Validator().validate(data)
if error_list:
self.fail(''.join(error_list))
break
else:
self.fail('Attachment not found in email')
class TestODSDeferredStyle(TestDeferredStyle): class TestODSDeferredStyle(TestDeferredStyle):
skin = 'ODS' skin = 'ODS'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment