1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-12-22 12:50:18 +01:00

add unit test for login failure

This commit is contained in:
kakwa 2015-10-20 22:42:29 +02:00
parent c397afab4a
commit 9c1dc8112a

View File

@ -156,6 +156,7 @@ class TestError(object):
def testLogin(self):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry_test.ini', app)
app.auth_mode = 'or'
try:
app.login('jwatson', 'passwordwatson')
except cherrypy.HTTPRedirect as e:
@ -164,6 +165,18 @@ class TestError(object):
else:
raise AssertionError("expected an exception")
def testLoginFailure(self):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry_test.ini', app)
app.auth_mode = 'or'
try:
app.login('jwatson', 'wrongPassword')
except cherrypy.HTTPRedirect as e:
expected = 'http://127.0.0.1:8080/signin'
assert e[0][0] == expected
else:
raise AssertionError("expected an exception")
def testSearch(self):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry_test.ini', app)