aboutsummaryrefslogtreecommitdiffstats
path: root/test_archivemail
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2010-07-31 15:35:31 +0200
committerNikolaus Schulz <microschulz@web.de>2010-07-31 20:49:29 +0200
commitf1f34ca46e9ea81e85d6728cb7c74cb815860cca (patch)
treed0a05b14ad686b4f991ccb70af055b6fdad3ed52 /test_archivemail
parent67f23e1af4a9adc43aea08790c4d3b349c75297d (diff)
downloadarchivemail-f1f34ca46e9ea81e85d6728cb7c74cb815860cca.tar.gz
archivemail-f1f34ca46e9ea81e85d6728cb7c74cb815860cca.tar.bz2
archivemail-f1f34ca46e9ea81e85d6728cb7c74cb815860cca.zip
Don't create hidden archives when archiving mailboxes with leading dots in the name
When archiving a mailbox with leading dots in the name and no archive name prefix specified, strip the dots off the archive name. This is targeting Maildir++ subfolders.
Diffstat (limited to 'test_archivemail')
-rwxr-xr-xtest_archivemail22
1 files changed, 22 insertions, 0 deletions
diff --git a/test_archivemail b/test_archivemail
index 3bc278a..9d015cc 100755
--- a/test_archivemail
+++ b/test_archivemail
@@ -968,6 +968,28 @@ class TestArchiveAffixes(unittest.TestCase):
archivemail.options.archive_suffix = None
archivemail.options.quiet = False
+class TestArchiveHiddenMbox(unittest.TestCase):
+ def setUp(self):
+ archivemail.options.quiet = True
+ self.mbox = ".upper.lower"
+
+ def testHiddenMbox(self):
+ """leading dots are stripped from the archive name when no prefix is added"""
+ self.assertEqual(archivemail.make_archive_name(self.mbox),
+ self.mbox.lstrip('.') +
+ archivemail.options.archive_default_suffix)
+
+ def testHiddenMboxPrefixedArchive(self):
+ """no dots are stripped from the archive name when a prefix is added"""
+ prefix = ".hidden_"
+ archivemail.options.archive_prefix = prefix
+ self.assertEqual(archivemail.make_archive_name(self.mbox),
+ prefix + self.mbox)
+
+ def tearDown(self):
+ archivemail.options.quiet = False
+ archivemail.options.archive_prefix = None
+
class TestArchiveDryRun(TestArchive):
"""make sure the 'dry-run' option works"""
def setUp(self):