def test_item_substring_any(self): text = r'*foo*' filt = pureldap.LDAPFilter_substrings( type='cn', substrings=[pureldap.LDAPFilter_substrings_any('foo'), ]) self.assertEquals(ldapfilter.parseMaybeSubstring('cn', text), filt)
def test_item_substring_if(self): text = r'foo*bar' filt = pureldap.LDAPFilter_substrings( type='cn', substrings=[pureldap.LDAPFilter_substrings_initial('foo'), pureldap.LDAPFilter_substrings_final('bar'), ]) self.assertEquals(ldapfilter.parseMaybeSubstring('cn', text), filt)
def test_escape_simple(self): text = r'f\2aoo(bar' filt = pureldap.LDAPFilter_equalityMatch( attributeDesc=pureldap.LDAPAttributeDescription(value='cn'), assertionValue=pureldap.LDAPAssertionValue(value='f*oo(bar')) self.assertEquals(ldapfilter.parseMaybeSubstring('cn', text), filt)
def test_item_present(self): text = r'*' filt = pureldap.LDAPFilter_present(value='cn') self.assertEquals(ldapfilter.parseMaybeSubstring('cn', text), filt)