From 0a63361bdfafe6e6e54d793e5efa967e41b91f0b Mon Sep 17 00:00:00 2001 From: Nicolas Delaby <nicolas@nexedi.com> Date: Sat, 4 Dec 2010 15:41:35 +0000 Subject: [PATCH] Even if the iteration succeeds, the test was failing. 'else' clause is triggered if there was no next item in the list. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41130 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5OOo/tests/testDeferredStyle.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/product/ERP5OOo/tests/testDeferredStyle.py b/product/ERP5OOo/tests/testDeferredStyle.py index 18045b5a8e..c5b2c0be67 100644 --- a/product/ERP5OOo/tests/testDeferredStyle.py +++ b/product/ERP5OOo/tests/testDeferredStyle.py @@ -101,7 +101,9 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): 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) + failed = True for part in mail_message.walk(): + failed = False content_type = part.get_content_type() file_name = part.get_filename() # "History" is the title of Base_viewHistory form @@ -115,7 +117,7 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): if error_list: self.fail(''.join(error_list)) break - else: + if failed: self.fail('Attachment not found in email') def test_normal_form(self): @@ -136,7 +138,9 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): 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) + failed = True for part in mail_message.walk(): + failed = False content_type = part.get_content_type() file_name = part.get_filename() # "Person" is the title of Person_view form @@ -150,7 +154,7 @@ class TestDeferredStyle(ERP5TypeTestCase, ZopeTestCase.Functional): if error_list: self.fail(''.join(error_list)) break - else: + if failed: self.fail('Attachment not found in email') -- 2.30.9