aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2009-03-03 01:18:32 +0100
committerNikolaus Schulz <microschulz@web.de>2010-07-19 01:13:25 +0200
commit84f42ead36ac7de5d52c5ca5bb2bfa1c40486883 (patch)
tree1f3c6c3d5e8fad90c645ec09792f5d5d0851e960
parent512130df02e58d5c6630805a3532a5e26e6b792d (diff)
downloadarchivemail-84f42ead36ac7de5d52c5ca5bb2bfa1c40486883.tar.gz
archivemail-84f42ead36ac7de5d52c5ca5bb2bfa1c40486883.tar.bz2
archivemail-84f42ead36ac7de5d52c5ca5bb2bfa1c40486883.zip
test suite: cut down the test of the --all option
Don't do entire test archiving runs, just call archivemail.should_archive().
-rwxr-xr-xtest_archivemail.py28
1 files changed, 9 insertions, 19 deletions
diff --git a/test_archivemail.py b/test_archivemail.py
index 8c41adc..a65f6cc 100755
--- a/test_archivemail.py
+++ b/test_archivemail.py
@@ -702,34 +702,24 @@ class TestArchiveMboxTimestamp(TestCaseInTempdir):
super(TestArchiveMboxTimestamp, self).tearDown()
-class TestArchiveMboxAll(TestCaseInTempdir):
+class TestArchiveMboxAll(unittest.TestCase):
def setUp(self):
- super(TestArchiveMboxAll, self).setUp()
archivemail.options.quiet = 1
archivemail.options.archive_all = 1
def testNew(self):
- """archiving --all messages in a new mailbox"""
- self.mbox_name = make_mbox(messages=3, hours_old=(24 * 179))
- self.mbox_mode = os.stat(self.mbox_name)[stat.ST_MODE]
- self.copy_name = tempfile.mkstemp()[1]
- 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))
+ """new messages should be archived with --all"""
+ self.msg = make_message(hours_old=24*179, wantobj=True)
+ assert(archivemail.should_archive(self.msg))
+
+ def testOld(self):
+ """old messages should be archived with --all"""
+ self.msg = make_message(hours_old=24*181, wantobj=True)
+ assert(archivemail.should_archive(self.msg))
def tearDown(self):
archivemail.options.quiet = 0
archivemail.options.archive_all = 0
- super(TestArchiveMboxAll, self).tearDown()
class TestArchiveMboxPreserveUnread(unittest.TestCase):
"""make sure the 'preserve_unread' option works"""