Skip to content

Commit

Permalink
adding test on login
Browse files Browse the repository at this point in the history
  • Loading branch information
kakwa committed May 28, 2015
1 parent a335b7c commit 8387aa0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions tests/test_LdapCherry.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
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"""
Expand Down Expand Up @@ -76,8 +78,6 @@ def testInitgBackendModuleFail(self):
else:
raise AssertionError("expected an exception")



def testLog(self):
app = LdapCherry()
cfg = { 'global' : {}}
Expand Down Expand Up @@ -113,6 +113,17 @@ def testRandomException(self):
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)
Expand Down

0 comments on commit 8387aa0

Please sign in to comment.