1
0
Fork 0
mirror of https://git.code.sf.net/p/archivemail/code synced 2025-01-03 05:34:58 +00:00

test suite: test weird message headers in one run

Before, every test header was tested in a separate archiving run.
This commit is contained in:
Nikolaus Schulz 2008-09-30 13:07:19 +02:00
parent 573cbbce91
commit 232b2256c2

View file

@ -631,15 +631,19 @@ This is after the ^From line"""
'Resent-Date' : '', 'Resent-Date' : '',
}, },
) )
fd, self.mbox_name = tempfile.mkstemp()
fp = os.fdopen(fd, "w")
for headers in weird_headers: for headers in weird_headers:
self.mbox_name = make_mbox(messages=3, headers=headers) msg_text = make_message(default_headers=headers)
self.copy_name = tempfile.mkstemp()[1] fp.write(msg_text*2)
shutil.copyfile(self.mbox_name, self.copy_name) fp.close()
archivemail.archive(self.mbox_name) self.copy_name = tempfile.mkstemp()[1]
assert(os.path.exists(self.mbox_name)) shutil.copyfile(self.mbox_name, self.copy_name)
self.assertEqual(os.path.getsize(self.mbox_name), 0) archivemail.archive(self.mbox_name)
archive_name = self.mbox_name + "_archive.gz" assert(os.path.exists(self.mbox_name))
assertEqualContent(archive_name, self.copy_name, zipfirst=True) self.assertEqual(os.path.getsize(self.mbox_name), 0)
archive_name = self.mbox_name + "_archive.gz"
assertEqualContent(archive_name, self.copy_name, zipfirst=True)
def tearDown(self): def tearDown(self):
archivemail.options = self.oldopts archivemail.options = self.oldopts