Пример #1
0
 def testDelUserDontExists(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     try:
         inv.del_user('test')
         inv.del_user('test')
     except UserDoesntExist:
         return
     else:
         raise AssertionError("expected an exception")
Пример #2
0
 def testDelUserDontExists(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     try:
         inv.del_user('test')
         inv.del_user('test')
     except UserDoesntExist:
         return
     else:
         raise AssertionError("expected an exception")
Пример #3
0
 def testAddUser(self):
     try:
         inv.del_user(u'test☭')
     except:
         pass
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     user = {
     'uid': u'test☭',
     'sn':  'test',
     'cn':  'test',
     'userPassword': '******',
     'uidNumber': '42',
     'gidNumber': '42',
     'homeDirectory': '/home/test/'
     }
     inv.add_user(user)
     inv.del_user(u'test☭')
Пример #4
0
 def testGetGroups(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     inv.add_user(default_user)
     inv.add_to_groups('default_user', default_groups)
     ret = inv.get_groups('default_user')
     expected = Set(default_groups)
     assert ret == expected
Пример #5
0
 def testSearchUser(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     inv.add_user(default_user)
     inv.add_user(default_user2)
     ret = inv.search('default')
     expected = ['default_user', 'default_user2']
     assert Set(ret.keys()) == Set(expected)
Пример #6
0
 def testGetGroups(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     inv.add_user(default_user)
     inv.add_to_groups('default_user', default_groups)
     ret = inv.get_groups('default_user')
     expected = Set(default_groups)
     assert ret == expected
Пример #7
0
 def testSearchUser(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     inv.add_user(default_user)
     inv.add_user(default_user2)
     ret = inv.search('default')
     expected = ['default_user', 'default_user2']
     assert Set(ret.keys()) == Set(expected)
Пример #8
0
 def testModifyUser(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     user = {
         'uid': u'test☭',
         'sn': 'test',
         'cn': 'test',
         'userPassword': '******',
         'uidNumber': '42',
         'gidNumber': '42',
         'homeDirectory': '/home/test/'
     }
     inv.add_user(user)
     inv.set_attrs(u'test☭', {
         'gecos': 'test2',
         'homeDirectory': '/home/test/'
     })
     inv.del_user(u'test☭')
Пример #9
0
 def testModifyUser(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     user = {
     'uid': u'test☭',
     'sn':  'test',
     'cn':  'test',
     'userPassword': '******',
     'uidNumber': '42',
     'gidNumber': '42',
     'homeDirectory': '/home/test/'
     }
     inv.add_user(user)
     inv.set_attrs(u'test☭', {'gecos': 'test2', 'homeDirectory': '/home/test/'})
     inv.del_user(u'test☭')
Пример #10
0
 def testAddUserDuplicate(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     user = {
         'uid': 'test',
         'sn': 'test',
         'cn': 'test',
         'uidNumber': '42',
         'userPassword': '******',
         'gidNumber': '42',
         'homeDirectory': '/home/test/'
     }
     try:
         inv.add_user(user)
         inv.add_user(user)
     except UserAlreadyExists:
         inv.del_user('test')
         return
     else:
         inv.del_user('test')
         raise AssertionError("expected an exception")
Пример #11
0
 def testAddUserDuplicate(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     user = {
     'uid': 'test',
     'sn':  'test',
     'cn':  'test',
     'uidNumber': '42',
     'userPassword': '******',
     'gidNumber': '42',
     'homeDirectory': '/home/test/'
     }
     try:
         inv.add_user(user)
         inv.add_user(user)
     except UserAlreadyExists:
         inv.del_user('test')
         return
     else:
         inv.del_user('test')
         raise AssertionError("expected an exception")
Пример #12
0
 def testAddUser(self):
     try:
         inv.del_user(u'test☭')
     except:
         pass
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     user = {
         'uid': u'test☭',
         'sn': 'test',
         'cn': 'test',
         'userPassword': '******',
         'uidNumber': '42',
         'gidNumber': '42',
         'homeDirectory': '/home/test/'
     }
     inv.add_user(user)
     inv.del_user(u'test☭')
Пример #13
0
 def testNominal(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     return True
Пример #14
0
 def testAuthFailure(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     res = inv.auth('notauser', 'password') or inv.auth('default_user', 'notapassword')
     assert res == False
Пример #15
0
 def testAuthSuccess(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     ret = inv.auth('admin', 'admin')
     assert ret == True
Пример #16
0
 def testAuthSuccess(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     ret = inv.auth('admin', 'admin')
     assert ret == True
Пример #17
0
 def testAuthFailure(self):
     inv = Backend(cfg, cherrypy.log, 'test', attr, 'uid')
     res = inv.auth('notauser', 'password') or inv.auth(
         'default_user', 'notapassword')
     assert res == False