mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-25 18:54:29 +01:00
add unit test for login failure
This commit is contained in:
parent
c397afab4a
commit
9c1dc8112a
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user