Example #1
0
 def testSearchUser(self):
     inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
     ret = inv.search('smith')
     expected = {
         'ssmith': {
             'sn': 'smith',
             'uid': 'ssmith',
             'cn': 'Sheri Smith',
             'userPassword': '******'
         },
         'jsmith': {
             'sn': 'Smith',
             'uid': 'jsmith',
             'cn': 'John Smith',
             'userPassword': '******'
         }
     }
     assert ret == expected
Example #2
0
def syslog_error(msg='', context='', severity=logging.INFO, traceback=False):
    pass


cherrypy.log.error = syslog_error
attr = [
    'shéll', 'cn', 'uid', 'uidNumber', 'gidNumber', 'home', 'userPassword',
    'givenName', 'email', 'sn'
]

cherrypy.log.error = syslog_error

inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
print inv.get_user('jwatson')
print inv.get_groups('jwatson')
print inv.search('smit')
user = {
    'uid': 'test',
    'sn': 'test',
    'cn': 'test',
    'userPassword': '******',
    'uidNumber': '42',
    'gidNumber': '42',
    'homeDirectory': '/home/test/'
}
inv.add_user(user)
print inv.get_user('test')
print inv.get_groups('test')
inv.del_user('test')

groups = [
Example #3
0
}

def syslog_error(msg='', context='',
        severity=logging.INFO, traceback=False):
    pass

cherrypy.log.error = syslog_error
attr = ['shéll', 'cn', 'uid', 'uidNumber', 'gidNumber', 'home', 'userPassword', 'givenName', 'email', 'sn']

cherrypy.log.error = syslog_error

inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
print inv.get_user('jwatson')
print inv.get_groups('jwatson')
print inv.search('smit')
user = {
'uid': 'test',
'sn':  'test',
'cn':  'test',
'userPassword': '******',
'uidNumber': '42',
'gidNumber': '42',
'homeDirectory': '/home/test/'
}
inv.add_user(user)
print inv.get_user('test')
print inv.get_groups('test')
inv.del_user('test')

groups = [
Example #4
0
 def testSearchUser(self):
     inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
     ret = inv.search('smith')
     expected = {'ssmith': {'sn': 'smith', 'uid': 'ssmith', 'cn': 'Sheri Smith', 'userPassword': '******'}, 'jsmith': {'sn': 'Smith', 'uid': 'jsmith', 'cn': 'John Smith', 'userPassword': '******'}}
     assert ret == expected