Test case for invalid utf8 bytes in header.

This commit is contained in:
Stuart D. Gathman
2019-08-20 18:37:35 -04:00
parent d0d45c5e61
commit a01f598e37
2 changed files with 23 additions and 0 deletions
+6
View File
@@ -0,0 +1,6 @@
From the-concourse-on-high Sat Feb 2 13:01:43 2019
Date: Sat, 02 Feb 2019 19:48:56 +0100
To: stuart@[IPv6:fcd9:7f8a:e050:4b48:7fd6:7fa:5509:6e26]
Subject: 来自qq.com的退信
Does you receive this email?
+17
View File
@@ -21,6 +21,23 @@ class BMSMilterTestCase(unittest.TestCase):
self.zf.close() self.zf.close()
self.zf = None self.zf = None
def testHeader(self,fname='utf8'):
ctx = TestCtx()
Milter.factory = sample.sampleMilter
ctx._setsymval('{auth_authen}','batman')
ctx._setsymval('{auth_type}','batcomputer')
ctx._setsymval('j','mailhost')
rc = ctx._connect()
self.assertTrue(rc == Milter.CONTINUE)
with open('test/'+fname) as fp:
rc = ctx._feedFile(fp)
milter = ctx.getpriv()
self.assertFalse(ctx._bodyreplaced,"Message body not replaced")
fp = ctx._body
with open('test/'+fname+".tstout","wb") as ofp:
ofp.write(fp.getvalue())
ctx._close()
def testCtx(self,fname='virus1'): def testCtx(self,fname='virus1'):
ctx = TestCtx() ctx = TestCtx()
Milter.factory = sample.sampleMilter Milter.factory = sample.sampleMilter