1
0
Fork 0
mirror of https://github.com/kakwa/ldapcherry synced 2025-07-03 20:07:42 +02:00

fix test and exception handling in code

With python 2 it was possible to do exception[0][...] to recover
details about an exception.
It's no longer authorized with python 3.
Now, we must do something like exception.args or exception.urls.
fortunately this syntax also works with python 2.
So we use it for both.
This commit is contained in:
kakwa 2019-02-09 17:12:39 +01:00
parent 90ff69586b
commit baa3430e63
3 changed files with 7 additions and 7 deletions

View file

@ -105,8 +105,8 @@ class TestError(object):
try:
ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
except ldap.SERVER_DOWN as e:
assert e[0]['info'] == 'TLS: hostname does not match CN in peer certificate' or \
e[0]['info'] == '(unknown error code)'
assert e.args[0]['info'] == 'TLS: hostname does not match CN in peer certificate' or \
e.args[0]['info'] == '(unknown error code)'
else:
raise AssertionError("expected an exception")