def test_seq_parts_in_a_multipart(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = '*****@*****.**' outer['From'] = '*****@*****.**' outer.preamble = '' outer.epilogue = '' msg = MIMEText('hello world') outer.attach([msg]) outer.set_boundary('BOUNDARY') self.assertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: [email protected] From: [email protected] --BOUNDARY Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit hello world --BOUNDARY-- ''')
def test_no_parts_in_a_multipart(self): outer = MIMEBase('multipart', 'mixed') outer['Subject'] = 'A subject' outer['To'] = '*****@*****.**' outer['From'] = '*****@*****.**' outer.preamble = '' outer.epilogue = '' outer.set_boundary('BOUNDARY') msg = MIMEText('hello world') self.assertEqual(outer.as_string(), '''\ Content-Type: multipart/mixed; boundary="BOUNDARY" MIME-Version: 1.0 Subject: A subject To: [email protected] From: [email protected] --BOUNDARY --BOUNDARY-- ''')