mirror of
https://git.code.sf.net/p/archivemail/code
synced 2025-01-03 05:34:58 +00:00
test suite: adapt to new behaviour of parse_imap_url()
This also removes some pretty bogus test URLs.
This commit is contained in:
parent
1fa57aa577
commit
483a58879f
1 changed files with 15 additions and 25 deletions
|
@ -550,40 +550,34 @@ class TestParseIMAPUrl(unittest.TestCase):
|
||||||
archivemail.options.pwfile = None
|
archivemail.options.pwfile = None
|
||||||
|
|
||||||
urls_withoutpass = [
|
urls_withoutpass = [
|
||||||
('imaps://user@example.org@imap.example.org/upperbox/lowerbox',
|
('imap://user@example.org@imap.example.org/upperbox/lowerbox',
|
||||||
('user', None, 'example.org@imap.example.org',
|
('user', None, 'example.org@imap.example.org', 143,
|
||||||
'upperbox/lowerbox')),
|
'upperbox/lowerbox')),
|
||||||
('imaps://"user@example.org"@imap.example.org/upperbox/lowerbox',
|
('imap://"user@example.org"@imap.example.org/upperbox/lowerbox',
|
||||||
('user@example.org', None, 'imap.example.org',
|
('user@example.org', None, 'imap.example.org', 143,
|
||||||
'upperbox/lowerbox')),
|
'upperbox/lowerbox')),
|
||||||
('imaps://user@example.org"@imap.example.org/upperbox/lowerbox',
|
('imap://user@example.org"@imap.example.org/upperbox/lowerbox',
|
||||||
('user', None, 'example.org"@imap.example.org',
|
('user', None, 'example.org"@imap.example.org', 143,
|
||||||
'upperbox/lowerbox')),
|
'upperbox/lowerbox')),
|
||||||
('imaps://"user@example.org@imap.example.org/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')),
|
'upperbox/lowerbox')),
|
||||||
('imaps://"us\\"er@example.org"@imap.example.org/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')),
|
'upperbox/lowerbox')),
|
||||||
('imaps://user\\@example.org@imap.example.org/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'))
|
'upperbox/lowerbox'))
|
||||||
]
|
]
|
||||||
urls_withpass = [
|
urls_withpass = [
|
||||||
('imaps://user@example.org:passwd@imap.example.org/upperbox/lowerbox',
|
('imap://user@example.org:passwd@imap.example.org/upperbox/lowerbox',
|
||||||
('user@example.org', 'passwd', 'imap.example.org',
|
('user@example.org', 'passwd', 'imap.example.org', 143,
|
||||||
'upperbox/lowerbox'),
|
|
||||||
('user', None, 'example.org:passwd@imap.example.org',
|
|
||||||
'upperbox/lowerbox')),
|
'upperbox/lowerbox')),
|
||||||
('imaps://"user@example.org:passwd@imap.example.org/upperbox/lowerbox',
|
('imaps://"user@example.org:passwd@imap.example.org/upperbox/lowerbox',
|
||||||
('"user@example.org', "passwd", 'imap.example.org',
|
('"user@example.org', "passwd", 'imap.example.org', 993,
|
||||||
'upperbox/lowerbox'),
|
|
||||||
('"user', None, 'example.org:passwd@imap.example.org',
|
|
||||||
'upperbox/lowerbox')),
|
'upperbox/lowerbox')),
|
||||||
('imaps://u\\ser\\@example.org:"p@sswd"@imap.example.org/upperbox/lowerbox',
|
('imaps://u\\ser\\@example.org:"p@sswd"@imap.example.org/upperbox/lowerbox',
|
||||||
('u\\ser\\@example.org', 'p@sswd', 'imap.example.org',
|
('u\\ser\\@example.org', 'p@sswd', 'imap.example.org', 993,
|
||||||
'upperbox/lowerbox'),
|
|
||||||
('u\\ser\\', None, 'example.org:"p@sswd"@imap.example.org',
|
|
||||||
'upperbox/lowerbox'))
|
'upperbox/lowerbox'))
|
||||||
]
|
]
|
||||||
# These are invalid when the password's not stripped.
|
# These are invalid when the password's not stripped.
|
||||||
|
@ -597,7 +591,7 @@ class TestParseIMAPUrl(unittest.TestCase):
|
||||||
the URL, if present."""
|
the URL, if present."""
|
||||||
archivemail.options.pwfile = None
|
archivemail.options.pwfile = None
|
||||||
for mbstr in self.urls_withpass + self.urls_withoutpass:
|
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)
|
result = archivemail.parse_imap_url(url)
|
||||||
self.assertEqual(result, mbstr[1])
|
self.assertEqual(result, mbstr[1])
|
||||||
|
|
||||||
|
@ -605,12 +599,8 @@ class TestParseIMAPUrl(unittest.TestCase):
|
||||||
"""Parse test urls with --pwfile set. In this case the ':' character
|
"""Parse test urls with --pwfile set. In this case the ':' character
|
||||||
loses its meaning as a delimiter."""
|
loses its meaning as a delimiter."""
|
||||||
archivemail.options.pwfile = "whocares.txt"
|
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:
|
for mbstr in self.urls_onlywithpass:
|
||||||
url = mbstr[0][mbstr[0].find('://')+3:]
|
url = mbstr[0]
|
||||||
self.assertRaises(archivemail.UnexpectedError,
|
self.assertRaises(archivemail.UnexpectedError,
|
||||||
archivemail.parse_imap_url, url)
|
archivemail.parse_imap_url, url)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue