aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolaus Schulz <microschulz@web.de>2011-07-09 19:03:16 +0200
committerNikolaus Schulz <microschulz@web.de>2011-07-09 19:03:16 +0200
commit483a58879f4a503ce37523f7661ee950ea3c7947 (patch)
tree20e88d1151a847f3536f05bcab84fc39e9451551
parent1fa57aa57722f0da0f4f34aff99fc458bfa821d5 (diff)
downloadarchivemail-483a58879f4a503ce37523f7661ee950ea3c7947.tar.gz
archivemail-483a58879f4a503ce37523f7661ee950ea3c7947.tar.bz2
archivemail-483a58879f4a503ce37523f7661ee950ea3c7947.zip
test suite: adapt to new behaviour of parse_imap_url()
This also removes some pretty bogus test URLs.
-rwxr-xr-xtest_archivemail40
1 files 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)