fix the test protocol twisty
authorMark Hammond <mhammond@skippinet.com.au>
Sat, 28 Mar 2009 17:29:37 +1100
branchtwisty
changeset 127 06207d46f9c97313ebeb868d3cf72e14a2a83094
parent 126 4ccc7acb1102e98de1851a9619df3238ced6ea4e
child 128 f95653d4377dcb27c75805dd631523d86d2c38f3
push id1
push userroot
push dateWed, 08 Apr 2009 01:46:05 +0000
fix the test protocol
server/python/junius/proto/test/__init__.py
--- a/server/python/junius/proto/test/__init__.py
+++ b/server/python/junius/proto/test/__init__.py
@@ -50,24 +50,23 @@ class TestMessageProvider(object):
         logger.debug("Finished saving test message %r", result)
         # done
 
 # A 'converter' - takes a proto/test as input and creates a
 # 'raw/message/rfc822' as output.
 class TestConverter(base.ConverterBase):
     def convert(self, doc):
         me = doc['storage_key']
-        headers = """\
-From: from%(storage_key)d@test.com
-To: from%(storage_key)d@test.com
-Subject: This is test document %(storage_key)d
-""" % doc
-        headers = headers.replace('\n', '\r\n')
-        body = "Hello, this is test message %(storage_key)d" % doc
+        headers = {'from': 'From: from%(storage_key)d@test.com',
+                   'subject' : 'This is test document %(storage_key)d',
+        }
+        for h in headers:
+            headers[h] = headers[h] % doc
 
+        body = u"Hello, this is test message %(storage_key)d (with extended \xa9haracter!)" % doc
         new_doc = dict(headers=headers, body=body)
         return new_doc
 
 
 class TestAccount(base.AccountBase):
   def __init__(self, db, details):
     self.db = db
     self.details = details