1
0
Fork 0
mirror of https://github.com/kakwa/ldapcherry synced 2025-07-04 20:37:48 +02:00

fix unit tests

This commit is contained in:
kakwa 2015-07-26 09:26:04 +02:00
parent 7d55cb2d14
commit 2a4815e142
3 changed files with 48 additions and 15 deletions

View file

@ -144,7 +144,7 @@ class TestError(object):
def testLogin(self):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry.ini', app)
loadconf('./tests/cfg/ldapcherry_test.ini', app)
try:
app.login('jwatson', 'passwordwatson')
except cherrypy.HTTPRedirect as e:
@ -155,15 +155,46 @@ class TestError(object):
def testSearch(self):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry.ini', app)
expected = {u'ssmith': {'password': u'passwordsmith', 'cn': u'Sheri Smith', 'name': u'smith', 'uid': u'ssmith'}, u'jsmith': {'password': u'passwordsmith', 'cn': u'John Smith', 'name': u'Smith', 'uid': u'jsmith'}}
loadconf('./tests/cfg/ldapcherry_test.ini', app)
expected = {
u'ssmith': {
'password': u'passwordsmith',
'cn': u'Sheri Smith',
'name': u'smith',
'uid': u'ssmith',
'email': [u's.smith@example.com',
u'ssmith@example.com',
u'sheri.smith@example.com'
],
},
u'jsmith': {
'password': u'passwordsmith',
'cn': u'John Smith',
'name': u'Smith',
'uid': u'jsmith',
'email': [
'j.smith@example.com',
'jsmith@example.com',
'jsmith.smith@example.com'
],
}
}
ret = app._search('smith')
assert expected == ret
def testGetUser(self):
app = LdapCherry()
loadconf('./tests/cfg/ldapcherry.ini', app)
expected = {'password': u'passwordsmith', 'cn': u'Sheri Smith', 'uid': u'ssmith', 'name': u'smith'}
loadconf('./tests/cfg/ldapcherry_test.ini', app)
expected = {
'password': u'passwordsmith',
'cn': u'Sheri Smith',
'uid': u'ssmith',
'name': u'smith',
'email': [u's.smith@example.com',
u'ssmith@example.com',
u'sheri.smith@example.com'
],
}
ret = app._get_user('ssmith')
assert expected == ret