55import json
66import datetime
77import io
8+ import quopri
89import shutil
910
1011from django .conf import settings
1718from ietf .person .models import Person
1819from ietf .sync import iana , rfceditor
1920from ietf .utils .mail import outbox , empty_outbox
20- from ietf .utils .test_utils import login_testing_unauthorized , unicontent
21+ from ietf .utils .test_utils import login_testing_unauthorized
2122from ietf .utils .test_utils import TestCase
2223
2324
@@ -137,8 +138,10 @@ def test_iana_review_mail(self):
137138 draft = WgDraftFactory ()
138139
139140 subject_template = 'Subject: [IANA #12345] Last Call: <%(draft)s-%(rev)s.txt> (Long text) to Informational RFC'
140- msg_template = """From: "%(person)s via RT" <drafts-lastcall@iana.org>
141+ msg_template = """From: %(fromaddr)s
141142Date: Thu, 10 May 2012 12:00:0%(rtime)d +0000
143+ Content-Transfer-Encoding: quoted-printable
144+ Content-Type: text/plain; charset=utf-8
142145%(subject)s
143146
144147(BEGIN IANA %(tag)s%(embedded_name)s)
@@ -172,7 +175,10 @@ def test_iana_review_mail(self):
172175 if embedded_name or not 'Vacuous' in subject :
173176
174177 rtime = 7 * subjects .index (subject ) + 5 * tags .index (tag ) + embedded_names .index (embedded_name )
175- msg = msg_template % dict (person = Person .objects .get (user__username = "iana" ).name ,
178+ person = Person .objects .get (user__username = "iana" )
179+ fromaddr = person .email ().formatted_email ()
180+ msg = msg_template % dict (person = quopri .encodestring (person .name .encode ()),
181+ fromaddr = fromaddr ,
176182 draft = draft .name ,
177183 rev = draft .rev ,
178184 tag = tag ,
@@ -185,7 +191,7 @@ def test_iana_review_mail(self):
185191 self .assertEqual (doc_name , draft .name )
186192 self .assertEqual (review_time , datetime .datetime (2012 , 5 , 10 , 5 , 0 , rtime ))
187193 self .assertEqual (by , Person .objects .get (user__username = "iana" ))
188- self .assertTrue ("there are no IANA Actions" in comment .replace ("\n " , "" ))
194+ self .assertIn ("there are no IANA Actions" , comment .replace ("\n " , "" ))
189195
190196 events_before = DocEvent .objects .filter (doc = draft , type = "iana_review" ).count ()
191197 iana .add_review_comment (doc_name , review_time , by , comment )
0 commit comments