aboutsummaryrefslogtreecommitdiffstats
path: root/test_archivemail.py
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2008-09-30 13:30:34 +0200
committerNikolaus Schulz <microschulz@web.de>2010-07-19 01:13:25 +0200
commit6d2e23ac806f7a9def231e201b48879d304c4cd6 (patch)
tree4248e3716e994ae5dd695332e9e566b4996c6358 /test_archivemail.py
parent8ec8a00ffadbb0ab935f23145a1156b8b2dc01c7 (diff)
downloadarchivemail-6d2e23ac806f7a9def231e201b48879d304c4cd6.tar.gz
archivemail-6d2e23ac806f7a9def231e201b48879d304c4cd6.tar.bz2
archivemail-6d2e23ac806f7a9def231e201b48879d304c4cd6.zip
test suite: cut down the test of --output-dir
Don't do entire test archiving runs, just call archivemail.make_archive_name() and verify the result.
Diffstat (limited to 'test_archivemail.py')
-rwxr-xr-xtest_archivemail.py19
1 files changed, 5 insertions, 14 deletions
diff --git a/test_archivemail.py b/test_archivemail.py
index 9737b5b..519df72 100755
--- a/test_archivemail.py
+++ b/test_archivemail.py
@@ -947,30 +947,21 @@ class TestArchiveMboxFlagged(unittest.TestCase):
archivemail.options.quiet = 0
-class TestArchiveMboxOutputDir(TestCaseInTempdir):
+class TestArchiveMboxOutputDir(unittest.TestCase):
"""make sure that the 'output-dir' option works"""
def setUp(self):
- super(TestArchiveMboxOutputDir, self).setUp()
archivemail.options.quiet = 1
def testOld(self):
"""archiving an old mailbox with a sepecified output dir"""
- 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)
- self.dir_name = tempfile.mkdtemp()
- archivemail.options.output_dir = self.dir_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.dir_name + "/" + \
- os.path.basename(self.mbox_name) + "_archive.gz"
- assertEqualContent(archive_name, self.copy_name, zipfirst=True)
+ for dir in "/just/a/path", "relative/path":
+ archivemail.options.output_dir = dir
+ archive_dir = archivemail.make_archive_name("/tmp/mbox")
+ self.assertEqual(dir, os.path.dirname(archive_dir))
def tearDown(self):
archivemail.options.quiet = 0
archivemail.options.output_dir = None
- super(TestArchiveMboxOutputDir, self).tearDown()
class TestArchiveMboxUncompressed(TestCaseInTempdir):