mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 09:24:21 +01:00
adding test on login
This commit is contained in:
parent
a335b7c109
commit
8387aa0cad
@ -15,6 +15,8 @@ from cherrypy.process import plugins, servers
|
|||||||
from cherrypy import Application
|
from cherrypy import Application
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
cherrypy.session = {}
|
||||||
|
|
||||||
# monkey patching cherrypy to disable config interpolation
|
# monkey patching cherrypy to disable config interpolation
|
||||||
def new_as_dict(self, raw=True, vars=None):
|
def new_as_dict(self, raw=True, vars=None):
|
||||||
"""Convert an INI file to a dictionary"""
|
"""Convert an INI file to a dictionary"""
|
||||||
@ -76,8 +78,6 @@ class TestError(object):
|
|||||||
else:
|
else:
|
||||||
raise AssertionError("expected an exception")
|
raise AssertionError("expected an exception")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def testLog(self):
|
def testLog(self):
|
||||||
app = LdapCherry()
|
app = LdapCherry()
|
||||||
cfg = { 'global' : {}}
|
cfg = { 'global' : {}}
|
||||||
@ -113,6 +113,17 @@ class TestError(object):
|
|||||||
e = Exception()
|
e = Exception()
|
||||||
app._handle_exception(e)
|
app._handle_exception(e)
|
||||||
|
|
||||||
|
def testLogin(self):
|
||||||
|
app = LdapCherry()
|
||||||
|
loadconf('./tests/cfg/ldapcherry.ini', app)
|
||||||
|
try:
|
||||||
|
app.login('jwatson', 'passwordwatson')
|
||||||
|
except cherrypy.HTTPRedirect as e:
|
||||||
|
expected = 'http://127.0.0.1:8080/'
|
||||||
|
assert e[0][0] == expected
|
||||||
|
else:
|
||||||
|
raise AssertionError("expected an exception")
|
||||||
|
|
||||||
def testLogger(self):
|
def testLogger(self):
|
||||||
app = LdapCherry()
|
app = LdapCherry()
|
||||||
loadconf('./tests/cfg/ldapcherry.ini', app)
|
loadconf('./tests/cfg/ldapcherry.ini', app)
|
||||||
|
Loading…
Reference in New Issue
Block a user