1
0
mirror of https://github.com/kakwa/ldapcherry synced 2024-11-11 12:08:51 +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): def testLogin(self):
app = LdapCherry() app = LdapCherry()
loadconf('./tests/cfg/ldapcherry_test.ini', app) loadconf('./tests/cfg/ldapcherry_test.ini', app)
app.auth_mode = 'or'
try: try:
app.login('jwatson', 'passwordwatson') app.login('jwatson', 'passwordwatson')
except cherrypy.HTTPRedirect as e: except cherrypy.HTTPRedirect as e:
@ -164,6 +165,18 @@ class TestError(object):
else: else:
raise AssertionError("expected an exception") 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): def testSearch(self):
app = LdapCherry() app = LdapCherry()
loadconf('./tests/cfg/ldapcherry_test.ini', app) loadconf('./tests/cfg/ldapcherry_test.ini', app)