mirror of
https://git.code.sf.net/p/archivemail/code
synced 2025-01-02 21:24:40 +00:00
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.
This commit is contained in:
parent
8ec8a00ffa
commit
6d2e23ac80
1 changed files with 5 additions and 14 deletions
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue