# HG changeset patch # User Christof Meerwald # Date 1532828739 -3600 # Node ID b0048969990d2e38b35fd7cbc56408c15db1a975 # Parent da22ff1c3501e0fe0f097063bd2c90f476ab86c3 encoding fixes in test cases diff -r da22ff1c3501 -r b0048969990d test/db_test_base.py --- a/test/db_test_base.py Sun Jul 29 02:00:24 2018 +0100 +++ b/test/db_test_base.py Sun Jul 29 02:45:39 2018 +0100 @@ -34,7 +34,7 @@ from roundup.cgi.templating import HTMLItem from roundup.exceptions import UsageError, Reject -from roundup.anypy.strings import u2s +from roundup.anypy.strings import b2s, s2b, u2s from .mocknull import MockNull @@ -2588,9 +2588,9 @@ self.assert_("New submission from admin" in mail_msg) self.assert_("one two" in mail_msg) self.assert_("File 'test1.txt' not attached" not in mail_msg) - self.assert_(base64.encodestring("xxx").rstrip() in mail_msg) + self.assert_(b2s(base64.encodestring(s2b("xxx"))).rstrip() in mail_msg) self.assert_("File 'test2.txt' not attached" in mail_msg) - self.assert_(base64.encodestring("yyy").rstrip() not in mail_msg) + self.assert_(b2s(base64.encodestring(s2b("yyy"))).rstrip() not in mail_msg) finally : roundupdb._ = old_translate_ Mailer.smtp_send = backup @@ -2634,9 +2634,9 @@ self.assert_("New submission from admin" in mail_msg) self.assert_("one two" in mail_msg) self.assert_("File 'test1.txt' not attached" not in mail_msg) - self.assert_(base64.encodestring("xxx").rstrip() in mail_msg) + self.assert_(b2s(base64.encodestring(s2b("xxx"))).rstrip() in mail_msg) self.assert_("File 'test2.txt' not attached" in mail_msg) - self.assert_(base64.encodestring("yyy").rstrip() not in mail_msg) + self.assert_(b2s(base64.encodestring(s2b("yyy"))).rstrip() not in mail_msg) fp = FeedParser() mail_msg = str(res[1]["mail_msg"]) fp.feed(mail_msg) @@ -2657,9 +2657,9 @@ self.assert_("New submission from admin" in mail_msg) self.assert_("one two" in mail_msg) self.assert_("File 'test1.txt' not attached" not in mail_msg) - self.assert_(base64.encodestring("xxx").rstrip() in mail_msg) + self.assert_(b2s(base64.encodestring(s2b("xxx"))).rstrip() in mail_msg) self.assert_("File 'test2.txt' not attached" in mail_msg) - self.assert_(base64.encodestring("yyy").rstrip() not in mail_msg) + self.assert_(b2s(base64.encodestring(s2b("yyy"))).rstrip() not in mail_msg) finally : roundupdb._ = old_translate_ Mailer.smtp_send = backup diff -r da22ff1c3501 -r b0048969990d test/test_mailgw.py --- a/test/test_mailgw.py Sun Jul 29 02:00:24 2018 +0100 +++ b/test/test_mailgw.py Sun Jul 29 02:45:39 2018 +0100 @@ -28,7 +28,7 @@ reason="Skipping PGP tests: 'pyme' not installed")) -from roundup.anypy.strings import StringIO +from roundup.anypy.strings import StringIO, u2s if 'SENDMAILDEBUG' not in os.environ: os.environ['SENDMAILDEBUG'] = 'mail-test.log' @@ -2739,8 +2739,7 @@ def testEnc01(self): self.db.user.set(self.mary_id, - realname='\xe4\xf6\xfc\xc4\xd6\xdc\xdf, Mary'.decode - ('latin-1').encode('utf-8')) + realname=u2s(u'\xe4\xf6\xfc\xc4\xd6\xdc\xdf, Mary')) self.doNewIssue() self._handle_mail('''Content-Type: text/plain; charset="iso-8859-1"