aboutsummaryrefslogtreecommitdiffstats
path: root/test_archivemail
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2010-07-31 17:44:22 +0200
committerNikolaus Schulz <microschulz@web.de>2010-07-31 20:49:30 +0200
commit3a9a5cd4b8af84a7fd79bcf93bc1f2d5ba9ba7a6 (patch)
treee024dd9878ba40472f1fd3438482d549188cb903 /test_archivemail
parent04bf8eaa23f3b62d471b1389a23310de67d8d1eb (diff)
downloadarchivemail-3a9a5cd4b8af84a7fd79bcf93bc1f2d5ba9ba7a6.tar.gz
archivemail-3a9a5cd4b8af84a7fd79bcf93bc1f2d5ba9ba7a6.tar.bz2
archivemail-3a9a5cd4b8af84a7fd79bcf93bc1f2d5ba9ba7a6.zip
New option --archive-name, alias -a, to hard-code the archive filename
Diffstat (limited to 'test_archivemail')
-rwxr-xr-xtest_archivemail28
1 files changed, 28 insertions, 0 deletions
diff --git a/test_archivemail b/test_archivemail
index 3e9bf88..c49508f 100755
--- a/test_archivemail
+++ b/test_archivemail
@@ -434,6 +434,15 @@ class TestOptionParser(unittest.TestCase):
archivemail.options.parse_args(["-p", prefix], "")
self.assertEqual(archivemail.options.archive_prefix, prefix)
+ def testOptionArchivename(self):
+ """--archive-name and -a options are parsed correctly"""
+ for name in ("custom", ".withdot", "custom_%Y", "%Y/joe"):
+ archivemail.options.parse_args(["--archive-name="+name], "")
+ self.assertEqual(archivemail.options.archive_name, name)
+ archivemail.options.archive_name = None
+ archivemail.options.parse_args(["-a", name], "")
+ self.assertEqual(archivemail.options.archive_name, name)
+
def testOptionDryrun(self):
"""--dry-run option is parsed correctly"""
archivemail.options.parse_args(["--dry-run"], "")
@@ -938,6 +947,25 @@ class TestArchiveMboxPrefix(unittest.TestCase):
archivemail.options.quiet = False
archivemail.options.archive_prefix = None
+class TestArchiveName(unittest.TestCase):
+ def setUp(self):
+ archivemail.options.quiet = True
+
+ def testArchiveName(self):
+ """test the --archive-name option"""
+ archive_names = ("custom", ".withdot", "custom_%Y", "%Y/joe")
+ mbox = "foobar"
+ for name in archive_names:
+ archivemail.options.archive_name = name
+ days = archivemail.options.days_old_max
+ tm = time.localtime(time.time() - days*24*60*60)
+ name = time.strftime(name, tm)
+ self.assertEqual(archivemail.make_archive_name(mbox), name)
+
+ def tearDown(self):
+ archivemail.options.quiet = False
+ archivemail.options.archive_name = None
+
class TestArchiveAffixes(unittest.TestCase):
def setUp(self):
self.mbox = "harbsch"