def test_match_dn_in_cursor(self): self.delete_at_teardown.append( add_user(self.connection, testcase_id, 'mat-1')) self.delete_at_teardown.append( add_user(self.connection, testcase_id, 'mat-2')) self.delete_at_teardown.append( add_user(self.connection, testcase_id, 'mat-3')) o = ObjectDef('inetOrgPerson') o += AttrDef('cn', 'Common Name') o += AttrDef('sn', 'Surname') o += AttrDef(test_multivalued_attribute, 'Given Name') query_text = 'Common Name:=' + testcase_id + 'mat-*' r = Reader(self.connection, o, test_base, query_text) results = r.search() self.assertEqual(len(results), 3) e = r.match_dn('mat') # multiple matches self.assertEqual(len(e), 3) e = r.match_dn( '-3' ) # single match. there's domains with -20xx in their names, so use -3 to match self.assertEqual(len(e), 1) e = r.match_dn('no-match') # no match self.assertEqual(len(e), 0)
def test_match_dn_in_cursor(self): self.delete_at_teardown.append(add_user(self.connection, testcase_id, 'mat-1')) self.delete_at_teardown.append(add_user(self.connection, testcase_id, 'mat-2')) self.delete_at_teardown.append(add_user(self.connection, testcase_id, 'mat-3')) o = ObjectDef('inetOrgPerson') o += AttrDef('cn', 'Common Name') o += AttrDef('sn', 'Surname') o += AttrDef(test_multivalued_attribute, 'Given Name') query_text = 'Common Name:=' + testcase_id + 'mat-*' r = Reader(self.connection, o, test_base, query_text) results = r.search() self.assertEqual(len(results), 3) e = r.match_dn('mat') # multiple matches self.assertEqual(len(e), 3) e = r.match_dn('-2') # single match self.assertEqual(len(e), 1) e = r.match_dn('no-match') # no match self.assertEqual(len(e), 0)
def test_match_dn_in_cursor(self): self.delete_at_teardown.append( add_user(self.connection, testcase_id, 'match-1')) self.delete_at_teardown.append( add_user(self.connection, testcase_id, 'match-2')) self.delete_at_teardown.append( add_user(self.connection, testcase_id, 'match-3')) o = ObjectDef('inetOrgPerson') o += AttrDef('cn', 'Common Name') o += AttrDef('sn', 'Surname') o += AttrDef('givenName', 'Given Name') query_text = 'Common Name:=' + testcase_id + 'match-*' r = Reader(self.connection, o, test_base, query_text) results = r.search() self.assertEqual(len(results), 3) e = r.match_dn('match') # multiple matches self.assertEqual(len(e), 3) e = r.match_dn('-2') # single match self.assertEqual(len(e), 1) e = r.match_dn('no-match') # no match self.assertEqual(len(e), 0)