1
0
Fork 0
mirror of https://git.code.sf.net/p/archivemail/code synced 2024-12-21 23:32:54 +00:00

test suite: add simple test for parsing IMAP urls specifying port numbers

This commit is contained in:
Nikolaus Schulz 2011-07-09 18:03:40 +02:00
parent eb07611fae
commit 14e5cd6eb1

View file

@ -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