def test_search_deleted_objects_ad(self): if test_server_type == 'AD': dn_to_delete, _ = add_user( self.connection, testcase_id, 'to-be-deleted-1', attributes={'givenName': 'to-be-deleted-1'}) sleep(1) self.connection.delete(dn_to_delete) sleep(1) result = self.connection.search( search_base=test_root_partition, search_filter='(&(isDeleted=TRUE)(cn=*' + testcase_id + '*deleted-1*))', search_scope=SUBTREE, attributes=[], controls=[show_deleted_control(criticality=True)]) if not self.connection.strategy.sync: response, result = self.connection.get_response(result) else: response = self.connection.response result = self.connection.result found = False for entry in response: if entry['type'] == 'searchResEntry' and testcase_id in entry[ 'dn']: found = True break self.assertTrue(found)
def test_search_extended_dn_ad(self): if test_server_type == 'AD': self.delete_at_teardown.append( add_user(self.connection, testcase_id, 'sea-1', attributes={'givenName': 'sea-1'})) result = self.connection.search( search_base=test_base, search_filter='(' + test_name_attr + '=' + testcase_id + 'sea-1)', attributes=[test_name_attr], controls=[extended_dn_control(), show_deleted_control()]) if not self.connection.strategy.sync: response, result = self.connection.get_response(result) else: response = self.connection.response result = self.connection.result self.assertEqual(result['description'], 'success') self.assertTrue('<GUID=' in response[0]['dn']) self.assertTrue('SID=' in response[0]['dn']) self.assertTrue('>;' in response[0]['dn'])
def test_search_deleted_objects_ad(self): if test_server_type == "AD": dn_to_delete, _ = add_user( self.connection, testcase_id, "to-be-deleted-1", attributes={"givenName": "to-be-deleted-1"} ) sleep(1) self.connection.delete(dn_to_delete) sleep(1) result = self.connection.search( search_base=test_root_partition, search_filter="(&(isDeleted=TRUE)(cn=*" + testcase_id + "*deleted-1*))", search_scope=SUBTREE, attributes=[], controls=[show_deleted_control(criticality=True)], ) if not self.connection.strategy.sync: response, result = self.connection.get_response(result) else: response = self.connection.response result = self.connection.result found = False for entry in response: if entry["type"] == "searchResEntry" and testcase_id in entry["dn"]: found = True break self.assertTrue(found)
def test_search_extended_dn_ad(self): if test_server_type == "AD": result = self.connection.search( search_base=test_base, search_filter="(" + test_name_attr + "=" + testcase_id + "search-1)", attributes=[test_name_attr], controls=[extended_dn_control(), show_deleted_control()], ) if not self.connection.strategy.sync: response, result = self.connection.get_response(result) else: response = self.connection.response result = self.connection.result self.assertEqual(result["description"], "success") self.assertTrue("<GUID=" in response[0]["dn"]) self.assertTrue("SID=" in response[0]["dn"]) self.assertTrue(">;" in response[0]["dn"])
def test_search_deleted_objects_ad(self): if test_server_type == 'AD': dn_to_delete, _ = add_user(self.connection, testcase_id, 'to-be-deleted-1', attributes={'givenName': 'to-be-deleted-1'}) sleep(1) self.connection.delete(dn_to_delete) sleep(1) result = self.connection.search(search_base=test_root_partition, search_filter='(&(isDeleted=TRUE)(cn=*' + testcase_id + '*deleted-1*))', search_scope=SUBTREE, attributes=[], controls=[show_deleted_control(criticality=True)]) if not self.connection.strategy.sync: response, result = self.connection.get_response(result) else: response = self.connection.response result = self.connection.result found = False for entry in response: if entry['type'] == 'searchResEntry' and testcase_id in entry['dn']: found = True break self.assertTrue(found)
def test_search_extended_dn_ad(self): if test_server_type == 'AD': result = self.connection.search(search_base=test_base, search_filter='(' + test_name_attr + '=' + testcase_id + 'search-1)', attributes=[test_name_attr], controls=[extended_dn_control(), show_deleted_control()]) if not self.connection.strategy.sync: response, result = self.connection.get_response(result) else: response = self.connection.response result = self.connection.result self.assertEqual(result['description'], 'success') self.assertTrue('<GUID=' in response[0]['dn']) self.assertTrue('SID=' in response[0]['dn']) self.assertTrue('>;' in response[0]['dn'])