aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2008-09-30 14:17:20 +0200
committerNikolaus Schulz <microschulz@web.de>2010-07-19 01:13:25 +0200
commit512130df02e58d5c6630805a3532a5e26e6b792d (patch)
treec7a293ad4421370e0b358db6d60303849a0b5220
parent03bfb88d309a39bfb6757a525445bc9a700db027 (diff)
downloadarchivemail-512130df02e58d5c6630805a3532a5e26e6b792d.tar.gz
archivemail-512130df02e58d5c6630805a3532a5e26e6b792d.tar.bz2
archivemail-512130df02e58d5c6630805a3532a5e26e6b792d.zip
test suite: cut down the test of the --preserve-unread option
Don't do entire test archiving runs, just call archivemail.should_archive().
-rwxr-xr-xtest_archivemail.py29
1 files changed, 8 insertions, 21 deletions
diff --git a/test_archivemail.py b/test_archivemail.py
index fb308a6..8c41adc 100755
--- a/test_archivemail.py
+++ b/test_archivemail.py
@@ -731,39 +731,26 @@ class TestArchiveMboxAll(TestCaseInTempdir):
archivemail.options.archive_all = 0
super(TestArchiveMboxAll, self).tearDown()
-class TestArchiveMboxPreserveUnread(TestCaseInTempdir):
+class TestArchiveMboxPreserveUnread(unittest.TestCase):
"""make sure the 'preserve_unread' option works"""
def setUp(self):
- super(TestArchiveMboxPreserveUnread, self).setUp()
archivemail.options.quiet = 1
archivemail.options.preserve_unread = 1
+ self.msg = make_message(hours_old=24*181, wantobj=True)
def testOldRead(self):
- """archiving an old read mailbox should create an archive"""
- self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181), \
- headers={"Status":"RO"})
- 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)
- archive_name = self.mbox_name + "_archive.gz"
- assertEqualContent(archive_name, self.copy_name, zipfirst=True)
+ """old read messages should be archived with --preserve-unread"""
+ self.msg["Status"] = "RO"
+ assert(archivemail.should_archive(self.msg))
def testOldUnread(self):
- """archiving an unread mailbox should not create an archive"""
- self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181))
- self.copy_name = tempfile.mkstemp()[1]
- shutil.copyfile(self.mbox_name, self.copy_name)
- archivemail.archive(self.mbox_name)
- assertEqualContent(self.mbox_name, self.copy_name)
- archive_name = self.mbox_name + "_archive.gz"
- assert(not os.path.exists(archive_name))
+ """old unread messages should not be archived with --preserve-unread"""
+ self.msg["Status"] = "O"
+ assert(not archivemail.should_archive(self.msg))
def tearDown(self):
archivemail.options.quiet = 0
archivemail.options.preserve_unread = 0
- super(TestArchiveMboxPreserveUnread, self).tearDown()
class TestArchiveMboxSuffix(unittest.TestCase):