From 483a58879f4a503ce37523f7661ee950ea3c7947 Mon Sep 17 00:00:00 2001 From: Nikolaus Schulz Date: Sat, 9 Jul 2011 19:03:16 +0200 Subject: test suite: adapt to new behaviour of parse_imap_url() This also removes some pretty bogus test URLs. --- test_archivemail | 40 +++++++++++++++------------------------- 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/test_archivemail b/test_archivemail index 074b810..27015da 100755 --- a/test_archivemail +++ b/test_archivemail @@ -550,40 +550,34 @@ class TestParseIMAPUrl(unittest.TestCase): archivemail.options.pwfile = None urls_withoutpass = [ - ('imaps://user@example.org@imap.example.org/upperbox/lowerbox', - ('user', None, 'example.org@imap.example.org', + ('imap://user@example.org@imap.example.org/upperbox/lowerbox', + ('user', None, 'example.org@imap.example.org', 143, 'upperbox/lowerbox')), - ('imaps://"user@example.org"@imap.example.org/upperbox/lowerbox', - ('user@example.org', None, 'imap.example.org', + ('imap://"user@example.org"@imap.example.org/upperbox/lowerbox', + ('user@example.org', None, 'imap.example.org', 143, 'upperbox/lowerbox')), - ('imaps://user@example.org"@imap.example.org/upperbox/lowerbox', - ('user', None, 'example.org"@imap.example.org', + ('imap://user@example.org"@imap.example.org/upperbox/lowerbox', + ('user', None, 'example.org"@imap.example.org', 143, 'upperbox/lowerbox')), ('imaps://"user@example.org@imap.example.org/upperbox/lowerbox', - ('"user', None, 'example.org@imap.example.org', + ('"user', None, 'example.org@imap.example.org', 993, 'upperbox/lowerbox')), ('imaps://"us\\"er@example.org"@imap.example.org/upperbox/lowerbox', - ('us"er@example.org', None, 'imap.example.org', + ('us"er@example.org', None, 'imap.example.org', 993, 'upperbox/lowerbox')), ('imaps://user\\@example.org@imap.example.org/upperbox/lowerbox', - ('user\\', None, 'example.org@imap.example.org', + ('user\\', None, 'example.org@imap.example.org', 993, 'upperbox/lowerbox')) ] urls_withpass = [ - ('imaps://user@example.org:passwd@imap.example.org/upperbox/lowerbox', - ('user@example.org', 'passwd', 'imap.example.org', - 'upperbox/lowerbox'), - ('user', None, 'example.org:passwd@imap.example.org', + ('imap://user@example.org:passwd@imap.example.org/upperbox/lowerbox', + ('user@example.org', 'passwd', 'imap.example.org', 143, 'upperbox/lowerbox')), ('imaps://"user@example.org:passwd@imap.example.org/upperbox/lowerbox', - ('"user@example.org', "passwd", 'imap.example.org', - 'upperbox/lowerbox'), - ('"user', None, 'example.org:passwd@imap.example.org', + ('"user@example.org', "passwd", 'imap.example.org', 993, 'upperbox/lowerbox')), ('imaps://u\\ser\\@example.org:"p@sswd"@imap.example.org/upperbox/lowerbox', - ('u\\ser\\@example.org', 'p@sswd', 'imap.example.org', - 'upperbox/lowerbox'), - ('u\\ser\\', None, 'example.org:"p@sswd"@imap.example.org', + ('u\\ser\\@example.org', 'p@sswd', 'imap.example.org', 993, 'upperbox/lowerbox')) ] # These are invalid when the password's not stripped. @@ -597,7 +591,7 @@ class TestParseIMAPUrl(unittest.TestCase): the URL, if present.""" archivemail.options.pwfile = None for mbstr in self.urls_withpass + self.urls_withoutpass: - url = mbstr[0][mbstr[0].find('://')+3:] + url = mbstr[0] result = archivemail.parse_imap_url(url) self.assertEqual(result, mbstr[1]) @@ -605,12 +599,8 @@ class TestParseIMAPUrl(unittest.TestCase): """Parse test urls with --pwfile set. In this case the ':' character loses its meaning as a delimiter.""" archivemail.options.pwfile = "whocares.txt" - for mbstr in self.urls_withpass: - url = mbstr[0][mbstr[0].find('://')+3:] - result = archivemail.parse_imap_url(url) - self.assertEqual(result, mbstr[2]) for mbstr in self.urls_onlywithpass: - url = mbstr[0][mbstr[0].find('://')+3:] + url = mbstr[0] self.assertRaises(archivemail.UnexpectedError, archivemail.parse_imap_url, url) -- cgit v1.2.3