Commit 72dfe4a0 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

modify assertions to get more meaningful errors in case of failure.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41383 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0e26fd0c
...@@ -104,11 +104,12 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -104,11 +104,12 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
for part in mail_message.walk(): for part in mail_message.walk():
content_type = part.get_content_type() content_type = part.get_content_type()
file_name = part.get_filename() file_name = part.get_filename()
# "History" is the title of Base_viewHistory form if content_type == self.content_type:
if file_name == 'History%s' % self.attachment_file_extension: # "History" is the title of Base_viewHistory form
self.assertEquals(content_type, self.content_type) file_name = part.get_filename()
self.assertEquals('attachment; filename="History%s"' % expected_file_name = 'History%s' % self.attachment_file_extension
self.attachment_file_extension, self.assertEquals(expected_file_name, file_name)
self.assertEquals('attachment; filename="%s"' % expected_file_name,
part.get('Content-Disposition')) part.get('Content-Disposition'))
data = part.get_payload(decode=True) data = part.get_payload(decode=True)
error_list = Validator().validate(data) error_list = Validator().validate(data)
...@@ -138,12 +139,12 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -138,12 +139,12 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional):
mail_message = email.message_from_string(message_text) mail_message = email.message_from_string(message_text)
for part in mail_message.walk(): for part in mail_message.walk():
content_type = part.get_content_type() content_type = part.get_content_type()
file_name = part.get_filename() if content_type == self.content_type:
# "Person" is the title of Person_view form # "Person" is the title of Person_view form
if file_name == 'Person%s' % self.attachment_file_extension: file_name = part.get_filename()
self.assertEquals(content_type, self.content_type) expected_file_name = 'Person%s' % self.attachment_file_extension
self.assertEquals('attachment; filename="Person%s"' % self.assertEquals(expected_file_name, file_name)
self.attachment_file_extension, self.assertEquals('attachment; filename="%s"' % expected_file_name,
part.get('Content-Disposition')) part.get('Content-Disposition'))
data = part.get_payload(decode=True) data = part.get_payload(decode=True)
error_list = Validator().validate(data) error_list = Validator().validate(data)
......
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