1
0
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:
kakwa 2015-05-28 09:46:11 +02:00
parent a335b7c109
commit 8387aa0cad

View File

@ -15,6 +15,8 @@ from cherrypy.process import plugins, servers
from cherrypy import Application
import logging
cherrypy.session = {}
# monkey patching cherrypy to disable config interpolation
def new_as_dict(self, raw=True, vars=None):
"""Convert an INI file to a dictionary"""
@ -76,8 +78,6 @@ class TestError(object):
else:
raise AssertionError("expected an exception")
def testLog(self):
app = LdapCherry()
cfg = { 'global' : {}}
@ -113,6 +113,17 @@ class TestError(object):
e = Exception()
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):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry.ini', app)