Skip to content

Commit c9bddc2

Browse files
committed
encoding fixes in test cases
1 parent 38a604d commit c9bddc2

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

test/db_test_base.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from roundup.cgi.templating import HTMLItem
3535
from roundup.exceptions import UsageError, Reject
3636

37-
from roundup.anypy.strings import u2s
37+
from roundup.anypy.strings import b2s, s2b, u2s
3838

3939
from .mocknull import MockNull
4040

@@ -2588,9 +2588,9 @@ def dummy_snd(s, to, msg, res=res) :
25882588
self.assert_("New submission from admin" in mail_msg)
25892589
self.assert_("one two" in mail_msg)
25902590
self.assert_("File 'test1.txt' not attached" not in mail_msg)
2591-
self.assert_(base64.encodestring("xxx").rstrip() in mail_msg)
2591+
self.assert_(b2s(base64.encodestring(s2b("xxx"))).rstrip() in mail_msg)
25922592
self.assert_("File 'test2.txt' not attached" in mail_msg)
2593-
self.assert_(base64.encodestring("yyy").rstrip() not in mail_msg)
2593+
self.assert_(b2s(base64.encodestring(s2b("yyy"))).rstrip() not in mail_msg)
25942594
finally :
25952595
roundupdb._ = old_translate_
25962596
Mailer.smtp_send = backup
@@ -2634,9 +2634,9 @@ def dummy_snd(s, to, msg, res=res) :
26342634
self.assert_("New submission from admin" in mail_msg)
26352635
self.assert_("one two" in mail_msg)
26362636
self.assert_("File 'test1.txt' not attached" not in mail_msg)
2637-
self.assert_(base64.encodestring("xxx").rstrip() in mail_msg)
2637+
self.assert_(b2s(base64.encodestring(s2b("xxx"))).rstrip() in mail_msg)
26382638
self.assert_("File 'test2.txt' not attached" in mail_msg)
2639-
self.assert_(base64.encodestring("yyy").rstrip() not in mail_msg)
2639+
self.assert_(b2s(base64.encodestring(s2b("yyy"))).rstrip() not in mail_msg)
26402640
fp = FeedParser()
26412641
mail_msg = str(res[1]["mail_msg"])
26422642
fp.feed(mail_msg)
@@ -2657,9 +2657,9 @@ def dummy_snd(s, to, msg, res=res) :
26572657
self.assert_("New submission from admin" in mail_msg)
26582658
self.assert_("one two" in mail_msg)
26592659
self.assert_("File 'test1.txt' not attached" not in mail_msg)
2660-
self.assert_(base64.encodestring("xxx").rstrip() in mail_msg)
2660+
self.assert_(b2s(base64.encodestring(s2b("xxx"))).rstrip() in mail_msg)
26612661
self.assert_("File 'test2.txt' not attached" in mail_msg)
2662-
self.assert_(base64.encodestring("yyy").rstrip() not in mail_msg)
2662+
self.assert_(b2s(base64.encodestring(s2b("yyy"))).rstrip() not in mail_msg)
26632663
finally :
26642664
roundupdb._ = old_translate_
26652665
Mailer.smtp_send = backup

test/test_mailgw.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
reason="Skipping PGP tests: 'pyme' not installed"))
2929

3030

31-
from roundup.anypy.strings import StringIO
31+
from roundup.anypy.strings import StringIO, u2s
3232

3333
if 'SENDMAILDEBUG' not in os.environ:
3434
os.environ['SENDMAILDEBUG'] = 'mail-test.log'
@@ -2739,8 +2739,7 @@ def testUnknownUser(self):
27392739

27402740
def testEnc01(self):
27412741
self.db.user.set(self.mary_id,
2742-
realname='\xe4\xf6\xfc\xc4\xd6\xdc\xdf, Mary'.decode
2743-
('latin-1').encode('utf-8'))
2742+
realname=u2s(u'\xe4\xf6\xfc\xc4\xd6\xdc\xdf, Mary'))
27442743
self.doNewIssue()
27452744
self._handle_mail('''Content-Type: text/plain;
27462745
charset="iso-8859-1"

0 commit comments

Comments
 (0)