Exemplo n.º 1
0
 def testGetGroups(self):
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     try:
         inv.add_user(default_user.copy())
         inv.add_to_groups(u'☭default_user', default_groups)
     except:
         pass
     ret = inv.get_groups(u'☭default_user')
     expected = ['Domain Admins', 'Backup Operators']
     inv.del_user(u'☭default_user')
     assert ret == expected
Exemplo n.º 2
0
 def testSetPassword(self):
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     try:
         inv.add_user(default_user.copy())
         inv.add_to_groups(u'☭default_user', default_groups)
     except:
         pass
     inv.set_attrs(u'☭default_user', {'unicodePwd': u'test☭P66642$'})
     ret = inv.auth(u'☭default_user', u'test☭P66642$')
     inv.del_user(u'☭default_user')
     assert ret == True
Exemplo n.º 3
0
 def testGetGroups(self):
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     try:
         inv.add_user(default_user.copy())
         inv.add_to_groups(u'☭default_user', default_groups)
     except:
         pass
     ret = inv.get_groups(u'☭default_user')
     expected = ['Domain Admins', 'Backup Operators']
     inv.del_user(u'☭default_user')
     assert ret == expected
Exemplo n.º 4
0
    def testSetPassword(self):
        inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
        try:
            inv.add_user(default_user.copy())
            inv.add_to_groups(u'☭default_user', default_groups)
        except:
            pass
	inv.set_attrs(u'☭default_user', {'unicodePwd': u'test☭P66642$'})
        ret = inv.auth(u'☭default_user', u'test☭P66642$')
        inv.del_user(u'☭default_user')
        assert ret == True
Exemplo n.º 5
0
 def testSearchUser(self):
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     try:
         inv.add_user(default_user.copy())
     except:
         pass
     inv.add_user(default_user2.copy())
     ret = inv.search(u'test☭')
     expected = [u'☭default_user', u'☭default_user2']
     inv.del_user(u'☭default_user')
     inv.del_user(u'☭default_user2')
     assert Set(ret.keys()) == Set(expected)
Exemplo n.º 6
0
 def testSearchUser(self):
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     try:
         inv.add_user(default_user.copy())
     except:
         pass
     inv.add_user(default_user2.copy())
     ret = inv.search(u'test☭')
     expected = [u'☭default_user', u'☭default_user2']
     inv.del_user(u'☭default_user')
     inv.del_user(u'☭default_user2')
     assert Set(ret.keys()) == Set(expected)
Exemplo n.º 7
0
 def testGetUser(self):
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     try:
         inv.add_user(default_user.copy())
         inv.add_to_groups(u'☭default_user', default_groups)
     except:
         pass
     ret = inv.get_user(u'☭default_user')
     expected = default_user
     inv.del_user(u'☭default_user')
     for i in default_user:
         if i != 'unicodePwd':
             assert ret[i] == expected[i]
Exemplo n.º 8
0
 def testGetUser(self):
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     try:
         inv.add_user(default_user.copy())
         inv.add_to_groups(u'☭default_user', default_groups)
     except:
         pass
     ret = inv.get_user(u'☭default_user')
     expected = default_user 
     inv.del_user(u'☭default_user')
     for i in default_user:
         if i != 'unicodePwd':
             assert ret[i] == expected[i]
Exemplo n.º 9
0
 def testModifyUser(self):
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     user = {
     'sAMAccountName': u'test☭',
     'sn':  u'test☭',
     'cn':  u'test☭',
     'unicodePwd': u'test☭Aowo87',
     '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☭')
Exemplo n.º 10
0
 def testModifyUser(self):
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     user = {
         'sAMAccountName': u'test☭',
         'sn': u'test☭',
         'cn': u'test☭',
         'unicodePwd': u'test☭Aowo87',
         '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☭')
Exemplo n.º 11
0
 def testAddUser(self):
     try:
         inv.del_user(u'test☭')
     except:
         pass
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     user = {
         'sAMAccountName': u'test☭',
         'sn': u'test☭',
         'cn': u'test☭',
         'unicodePwd': u'test☭0918M',
         'uidNumber': '42',
         'gidNumber': '42',
         'homeDirectory': '/home/test/'
     }
     inv.add_user(user)
     inv.del_user(u'test☭')
Exemplo n.º 12
0
 def testAddUser(self):
     try:
         inv.del_user(u'test☭')
     except:
         pass
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     user = {
     'sAMAccountName': u'test☭',
     'sn':  u'test☭',
     'cn':  u'test☭',
     'unicodePwd': u'test☭0918M',
     'uidNumber': '42',
     'gidNumber': '42',
     'homeDirectory': '/home/test/'
     }
     inv.add_user(user)
     inv.del_user(u'test☭')
Exemplo n.º 13
0
 def testAddUserDuplicate(self):
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     user = {
         'sAMAccountName': u'test☭',
         'sn': u'test☭',
         'cn': u'test☭',
         'uidNumber': '42',
         'unicodePwd': u'test☭aqosJK87',
         'gidNumber': '42',
         'homeDirectory': '/home/test/'
     }
     try:
         inv.add_user(user.copy())
         inv.add_user(user.copy())
     except UserAlreadyExists:
         inv.del_user(u'test☭')
         return
     else:
         inv.del_user(u'test☭')
         raise AssertionError("expected an exception")
Exemplo n.º 14
0
 def testAddUserDuplicate(self):
     inv = Backend(cfg, cherrypy.log, u'test☭', attr, 'sAMAccountName')
     user = {
     'sAMAccountName': u'test☭',
     'sn':  u'test☭',
     'cn':  u'test☭',
     'uidNumber': '42',
     'unicodePwd': u'test☭aqosJK87',
     'gidNumber': '42',
     'homeDirectory': '/home/test/'
     }
     try:
         inv.add_user(user.copy())
         inv.add_user(user.copy())
     except UserAlreadyExists:
         inv.del_user(u'test☭')
         return
     else:
         inv.del_user(u'test☭')
         raise AssertionError("expected an exception")