diff options
author | Nikolaus Schulz <microschulz@web.de> | 2008-09-30 13:27:33 +0200 |
---|---|---|
committer | Nikolaus Schulz <microschulz@web.de> | 2010-07-19 01:13:25 +0200 |
commit | 8ec8a00ffadbb0ab935f23145a1156b8b2dc01c7 (patch) | |
tree | 430fe8592c0df273828d01936c40f1d248463811 | |
parent | 0ca3f6ceeeb68f95953ceaeae61b188bf9899f70 (diff) | |
download | archivemail-8ec8a00ffadbb0ab935f23145a1156b8b2dc01c7.tar.gz archivemail-8ec8a00ffadbb0ab935f23145a1156b8b2dc01c7.tar.bz2 archivemail-8ec8a00ffadbb0ab935f23145a1156b8b2dc01c7.zip |
test suite: cut down testing the handling of flagged messages
Don't do entire test archiving runs, just call
archivemail.should_archive().
-rwxr-xr-x | test_archivemail.py | 39 |
1 files changed, 10 insertions, 29 deletions
diff --git a/test_archivemail.py b/test_archivemail.py index c84930f..9737b5b 100755 --- a/test_archivemail.py +++ b/test_archivemail.py @@ -917,53 +917,34 @@ class TestArchiveCopy(TestCaseInTempdir): super(TestArchiveCopy, self).tearDown() -class TestArchiveMboxFlagged(TestCaseInTempdir): +class TestArchiveMboxFlagged(unittest.TestCase): """make sure the 'include_flagged' option works""" def setUp(self): - super(TestArchiveMboxFlagged, self).setUp() archivemail.options.include_flagged = 0 archivemail.options.quiet = 1 def testOld(self): """by default, old flagged messages should not be archived""" - self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181), \ - headers={"X-Status":"F"}) - 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)) + msg = make_message(default_headers={"X-Status": "F"}, + hours_old=24*181, wantobj=True) + assert(not archivemail.should_archive(msg)) def testIncludeFlaggedNew(self): """new flagged messages should not be archived with include_flagged""" - self.mbox_name = make_mbox(messages=3, hours_old=(24 * 179), \ - headers={"X-Status":"F"}) - self.copy_name = tempfile.mkstemp()[1] - shutil.copyfile(self.mbox_name, self.copy_name) - archivemail.options.include_flagged = 1 - 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)) + msg = make_message(default_headers={"X-Status": "F"}, + hours_old=24*179, wantobj=True) + assert(not archivemail.should_archive(msg)) def testIncludeFlaggedOld(self): """old flagged messages should be archived with include_flagged""" - self.mbox_name = make_mbox(messages=3, hours_old=(24 * 181), \ - headers={"X-Status":"F"}) - self.copy_name = tempfile.mkstemp()[1] - shutil.copyfile(self.mbox_name, self.copy_name) archivemail.options.include_flagged = 1 - 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) + msg = make_message(default_headers={"X-Status": "F"}, + hours_old=24*181, wantobj=True) + assert(archivemail.should_archive(msg)) def tearDown(self): archivemail.options.include_flagged = 0 archivemail.options.quiet = 0 - super(TestArchiveMboxFlagged, self).tearDown() class TestArchiveMboxOutputDir(TestCaseInTempdir): |