Skip to content

Commit

Permalink
TestLDAPUrl.test_bad_urls(): One bad URL per line, put every failed U…
Browse files Browse the repository at this point in the history
…RL into a list to be displayed with self.fail()
  • Loading branch information
stroeder committed Dec 11, 2016
1 parent 946fe3f commit 29e740f
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions Tests/t_ldapurl.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,20 @@ def test_parse_extensions_novalue(self):
self.assertNone(u.who)

def test_bad_urls(self):
for bad in ("", "ldap:", "ldap:/", ":///", "://", "///", "//", "/",
failed_urls = []
for bad in (
"",
"ldap:",
"ldap:/",
":///",
"://",
"///",
"//",
"/",
"ldap:///?????", # extension can't start with '?'
"LDAP://", "invalid://", "ldap:///??invalid",
"LDAP://",
"invalid://",
"ldap:///??invalid",
#XXX-- the following should raise exceptions!
"ldap://:389/", # [host [COLON port]]
"ldap://a:/", # [host [COLON port]]
Expand All @@ -239,7 +250,9 @@ def test_bad_urls(self):
except ValueError:
pass
else:
self.fail("should have raised ValueError: %r" % bad)
failed_urls.append(bad)
if failed_urls:
self.fail("These LDAP URLs should have raised ValueError: %r" % failed_urls)

if __name__ == '__main__':
unittest.main()

0 comments on commit 29e740f

Please sign in to comment.