def test_modify(self): ld = LDAP(self.env['uri_389']) ld.bind(self.env['root_dn'], self.env['root_pw']) dtime = datetime.utcnow().strftime('%Y%m%d%H%M%S.%fZ') changes = [('description', ['Modified at %s' % (dtime, )], LDAP_MOD_REPLACE)] ld.modify(self.env['target_user'], changes)
def test_modify_with_relax(self): ld = LDAP(self.env['uri_389']) ld.bind(self.env['root_dn'], self.env['root_pw']) c = LDAPControl() c.add_control(LDAP_CONTROL_RELAX) dtime = datetime.utcnow().strftime('%Y%m%d%H%M%S.%fZ') changes = [('pwdAccountLockedTime', [dtime], LDAP_MOD_REPLACE)] ld.modify(self.env['target_user'], changes, controls=c)
def test_modify(self): ld = LDAP(self.env['uri_389']) ld.bind(self.env['root_dn'], self.env['root_pw']) dtime = datetime.utcnow().strftime('%Y%m%d%H%M%S.%fZ') changes = [ ('description', ['Modified at %s' % (dtime,)], LDAP_MOD_REPLACE) ] ld.modify(self.env['modify_user'], changes)
def setUp(self): server = os.environ.get('TEST_SERVER', 'ldap-server') self.env = Environment[server] self.compare_attribute = 'description' self.compare_value = 'This value will be compared' ld = LDAP(self.env['uri_389']) ld.bind(self.env['root_dn'], self.env['root_pw']) ld.modify(self.env['modify_user'], [(self.compare_attribute, [self.compare_value], LDAP_MOD_REPLACE)])
def setUp(self): server = os.environ.get('TEST_SERVER', 'ldap-server') self.env = Environment[server] self.compare_attribute = 'description' self.compare_value = 'This value will be compared' ld = LDAP(self.env['uri_389']) ld.bind(self.env['root_dn'], self.env['root_pw']) ld.modify( self.env['target_user'], [(self.compare_attribute, [self.compare_value], LDAP_MOD_REPLACE)])
def test_modify_with_relax(self): ld = LDAP(self.env['uri_389']) ld.bind(self.env['root_dn'], self.env['root_pw']) c = LDAPControl() c.add_control(LDAP_CONTROL_RELAX) dtime = datetime.utcnow().strftime('%Y%m%d%H%M%S.%fZ') changes = [ ('pwdAccountLockedTime', [dtime], LDAP_MOD_REPLACE) ] ld.modify(self.env['modify_user'], changes, controls=c)
def modifymiyabi(): ld = LDAP(URI) ld.bind(BIND_DN, BIND_PASS) result = ld.modify(('uid=miyabi2,ou=Users,dc=example,dc=jp'), [('userPassword', ['miyabi321'], LDAP_MOD_REPLACE)]) ld.unbind() return result
def test_modify_async(self): ld = LDAP(self.env['uri_389']) ld.bind(self.env['root_dn'], self.env['root_pw']) dtime = datetime.utcnow().strftime('%Y%m%d%H%M%S.%fZ') changes = [ ('description', ['Modified at %s' % (dtime,)], LDAP_MOD_REPLACE) ] msgid = ld.modify(self.env['modify_user'], changes, async=True) result = ld.result(msgid) self.assertEqual(result['return_code'], 0)
def test_modify_mod_delete(self): ld = LDAP(self.env['uri_389']) ld.bind(self.env['root_dn'], self.env['root_pw']) changes = [('description', [], LDAP_MOD_DELETE)] ld.modify(self.env['target_user'], changes)
def test_modify_mod_delete(self): ld = LDAP(self.env['uri_389']) ld.bind(self.env['root_dn'], self.env['root_pw']) changes = [('description', [], LDAP_MOD_DELETE)] ld.modify(self.env['modify_user'], changes)