aboutsummaryrefslogtreecommitdiffstats
path: root/test_archivemail.py
diff options
context:
space:
mode:
authorPaul Rodger <paul@paulrodger.com>2002-04-24 13:22:11 +0000
committerPaul Rodger <paul@paulrodger.com>2002-04-24 13:22:11 +0000
commitf1f2b97b1b6a5cb6a354104eb8a4eaf5c631ab16 (patch)
tree21200672b1db7c96d62971f9d45baf7920187f42 /test_archivemail.py
parent14d58baee112cb294fd2e856c79a9cf8a87b742e (diff)
downloadarchivemail-f1f2b97b1b6a5cb6a354104eb8a4eaf5c631ab16.tar.gz
archivemail-f1f2b97b1b6a5cb6a354104eb8a4eaf5c631ab16.tar.bz2
archivemail-f1f2b97b1b6a5cb6a354104eb8a4eaf5c631ab16.zip
Added another test, got ready for 0.4.2 release.
Diffstat (limited to 'test_archivemail.py')
-rwxr-xr-xtest_archivemail.py23
1 files changed, 18 insertions, 5 deletions
diff --git a/test_archivemail.py b/test_archivemail.py
index d6b10a3..bd149e3 100755
--- a/test_archivemail.py
+++ b/test_archivemail.py
@@ -25,11 +25,9 @@ TODO: add tests for:
* messages with corrupted date headers
* archiving maildir-format mailboxes
* archiving MH-format mailboxes
- * running archivemail via os.system()
+ * more tests running archivemail via os.system()
* preservation of status information from maildir to mbox
* a 3rd party process changing the mbox file being read
- * test to make sure the --date option works
- * test to make sure archiving dates < 1970 works
"""
@@ -352,17 +350,32 @@ class TestArchiveMbox(unittest.TestCase):
self.mbox_mode = os.stat(self.mbox_name)[stat.ST_MODE]
self.copy_name = tempfile.mktemp()
shutil.copyfile(self.mbox_name, self.copy_name)
-
archivemail.archive(self.mbox_name)
assert(os.path.exists(self.mbox_name))
self.assertEqual(os.path.getsize(self.mbox_name), 0)
new_mode = os.stat(self.mbox_name)[stat.ST_MODE]
self.assertEqual(self.mbox_mode, new_mode)
-
archive_name = self.mbox_name + "_archive.gz"
assert(os.path.exists(archive_name))
self.assertEqual(os.system("gzip -d %s" % archive_name), 0)
+ archive_name = self.mbox_name + "_archive"
+ assert(os.path.exists(archive_name))
+ assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))
+ def testOldFromInBody(self):
+ """archiving an old mailbox with 'From ' in the body"""
+ body = """This is a message with ^From at the start of a line
+From is on this line
+This is after the ^From line"""
+ self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181), body=body)
+ self.copy_name = tempfile.mktemp()
+ shutil.copyfile(self.mbox_name, self.copy_name)
+ archivemail.archive(self.mbox_name)
+ assert(os.path.exists(self.mbox_name))
+ self.assertEqual(os.path.getsize(self.mbox_name), 0)
+ archive_name = self.mbox_name + "_archive.gz"
+ assert(os.path.exists(archive_name))
+ self.assertEqual(os.system("gzip -d %s" % archive_name), 0)
archive_name = self.mbox_name + "_archive"
assert(os.path.exists(archive_name))
assert(filecmp.cmp(archive_name, self.copy_name, shallow=0))