def _p_extensible(s, l, t): attr, dn, matchingRule, value = t return pureldap.LDAPFilter_extensibleMatch( matchingRule=matchingRule, type=attr, matchValue=value, dnAttributes=dn)
def test_extensible_5(self): text = '(cn:1.2.3.4.5:=Fred Flintstone)' filt = pureldap.LDAPFilter_extensibleMatch( type='cn', dnAttributes=None, matchingRule='1.2.3.4.5', matchValue='Fred Flintstone', ) self.assertEqual(filt.asText(), text)
def test_extensible_5(self): text = "(cn:1.2.3.4.5:=Fred Flintstone)" filt = pureldap.LDAPFilter_extensibleMatch( type="cn", dnAttributes=None, matchingRule="1.2.3.4.5", matchValue="Fred Flintstone", ) self.assertEqual(filt.asText(), text)
def test_extensible_3(self): text = "(o:dn:=Ace Industry)" filt = pureldap.LDAPFilter_extensibleMatch( type="o", dnAttributes=True, matchingRule=None, matchValue="Ace Industry", ) self.assertEqual(ldapfilter.parseFilter(text), filt) self.assertEqual(filt.asText(), text)
def test_extensible_2(self): text = "(sn:dn:2.4.6.8.10:=Barney Rubble)" filt = pureldap.LDAPFilter_extensibleMatch( type="sn", dnAttributes=True, matchingRule="2.4.6.8.10", matchValue="Barney Rubble", ) self.assertEqual(ldapfilter.parseFilter(text), filt) self.assertEqual(filt.asText(), text)
def test_extensible_4(self): text = "(:dn:2.4.6.8.10:=Dino)" filt = pureldap.LDAPFilter_extensibleMatch( type=None, dnAttributes=True, matchingRule="2.4.6.8.10", matchValue="Dino", ) self.assertEqual(ldapfilter.parseFilter(text), filt) self.assertEqual(filt.asText(), text)
def test_extensible_4(self): text = '(:dn:2.4.6.8.10:=Dino)' self.assertEqual( ldapfilter.parseFilter(text), pureldap.LDAPFilter_extensibleMatch( type=None, dnAttributes=True, matchingRule='2.4.6.8.10', matchValue='Dino', ))
def test_extensible_3(self): text = '(o:dn:=Ace Industry)' self.assertEqual( ldapfilter.parseFilter(text), pureldap.LDAPFilter_extensibleMatch( type='o', dnAttributes=True, matchingRule=None, matchValue='Ace Industry', ))
def test_extensible_2(self): text = '(sn:dn:2.4.6.8.10:=Barney Rubble)' self.assertEqual( ldapfilter.parseFilter(text), pureldap.LDAPFilter_extensibleMatch( type='sn', dnAttributes=True, matchingRule='2.4.6.8.10', matchValue='Barney Rubble', ))
def test_extensible_1(self): text = '(cn:1.2.3.4.5:=Fred Flintstone)' self.assertEqual( ldapfilter.parseFilter(text), pureldap.LDAPFilter_extensibleMatch( type='cn', dnAttributes=False, matchingRule='1.2.3.4.5', matchValue='Fred Flintstone', ))
def test_extensibleMatch4_noMatch(self): """ An extensibleMatch filter that uses DN attributes does not match an entry based on its OU. See RFC4511 section 4.5.1. """ m = pureldap.LDAPFilter_extensibleMatch( matchingRule=None, type=pureldap.LDAPMatchingRuleAssertion_type(value='ou'), matchValue=pureldap.LDAPMatchingRuleAssertion_matchValue( value='fings'), dnAttributes=pureldap.LDAPMatchingRuleAssertion_dnAttributes( value=255)) o = inmemory.ReadOnlyInMemoryLDAPEntry( dn='cn=foo,ou=uvvers,dc=example,dc=com', attributes={ 'objectClass': ['a', 'b'], 'aValue': ['b'], 'num': [4], }) result = o.match(m) self.assertEqual(result, False)
def test_extensibleMatch4_noMatch(self): """ An extensibleMatch filter that uses DN attributes does not match an entry based on its OU. See RFC4511 section 4.5.1. """ m = pureldap.LDAPFilter_extensibleMatch( matchingRule=None, type=pureldap.LDAPMatchingRuleAssertion_type(value="ou"), matchValue=pureldap.LDAPMatchingRuleAssertion_matchValue( value="fings"), dnAttributes=pureldap.LDAPMatchingRuleAssertion_dnAttributes( value=255), ) o = inmemory.ReadOnlyInMemoryLDAPEntry( dn="cn=foo,ou=uvvers,dc=example,dc=com", attributes={ "objectClass": ["a", "b"], "aValue": ["b"], "num": [4], }, ) result = o.match(m) self.assertEqual(result, False)