aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2011-07-09 18:03:40 +0200
committerNikolaus Schulz <microschulz@web.de>2011-07-09 18:03:40 +0200
commit14e5cd6eb13fc36d5f41f9e651e4d1185a0f651a (patch)
tree9f44f36bdd3989296c016af98e17d8a359cbf4ab
parenteb07611faeaa3b0d6f1dad5852ccab231d3f1c24 (diff)
downloadarchivemail-14e5cd6eb13fc36d5f41f9e651e4d1185a0f651a.tar.gz
archivemail-14e5cd6eb13fc36d5f41f9e651e4d1185a0f651a.tar.bz2
archivemail-14e5cd6eb13fc36d5f41f9e651e4d1185a0f651a.zip
test suite: add simple test for parsing IMAP urls specifying port numbers
-rwxr-xr-xtest_archivemail13
1 files changed, 13 insertions, 0 deletions
diff --git a/test_archivemail b/test_archivemail
index c9f217c..074b810 100755
--- a/test_archivemail
+++ b/test_archivemail
@@ -614,6 +614,19 @@ class TestParseIMAPUrl(unittest.TestCase):
self.assertRaises(archivemail.UnexpectedError,
archivemail.parse_imap_url, url)
+ def testUrlsDefaultPorts(self):
+ """If an IMAP URL does not specify a server port, the standard ports
+ are used."""
+ archivemail.options.pwfile = "doesnotexist.txt"
+ self.assertEqual(143, archivemail.parse_imap_url("imap://user@host/box")[3])
+ self.assertEqual(993, archivemail.parse_imap_url("imaps://user@host/box")[3])
+
+ def testUrlsWithPassAndPortnumber(self):
+ """IMAP URLs with an embedded password and a server port number are
+ correctly parsed."""
+ self.assertEqual(1234, archivemail.parse_imap_url("imap://user:pass@host:1234/box")[3])
+ self.assertEqual(1234, archivemail.parse_imap_url("imap://user:pass@host:1234/box")[3])
+
def tearDown(self):
archivemail.options.quiet = False
archivemail.options.verbose = False