def test_parse_with_NOT_filter__exact(self): result = backend._Parser('(!(fn=test))') obj = {'fn': ['test'], 'sn': ['user']} self.failIf(result.matches(obj)) obj = {'fn': ['demo'], 'sn': ['user']} self.failUnless(result.matches(obj)) obj = {'fn': ['test3'], 'sn': ['test']} self.failUnless(result.matches(obj))
def test_parse_with_AND_filter__mixed(self): result = backend._Parser('(&(fn=test)(sn=*))') obj = {'fn': ['test'], 'sn': ['user']} self.failUnless(result.matches(obj)) obj = {'fn': ['test'], 'sn': ['person']} self.failUnless(result.matches(obj)) obj = {'fn': ['demo'], 'sn': ['user']} self.failIf(result.matches(obj))
def test_parse_with_simple_filter__exists(self): result = backend._Parser('(cn=*)') obj = {'cn': ['testuser']} self.failUnless(result.matches(obj)) obj = {'cn': ['testuser1']} self.failUnless(result.matches(obj)) obj = {'notcn': ['testuser']} self.failIf(result.matches(obj))
def test_parse_with_NOT_filter__exact(self): result = backend._Parser('(!(fn=test))') obj = { 'fn': ['test'], 'sn': ['user'] } self.failIf(result.matches(obj)) obj = { 'fn': ['demo'], 'sn': ['user'] } self.failUnless(result.matches(obj)) obj = { 'fn': ['test3'], 'sn': ['test'] } self.failUnless(result.matches(obj))
def test_parse_with_AND_filter__mixed(self): result = backend._Parser('(&(fn=test)(sn=*))') obj = { 'fn': ['test'], 'sn': ['user'] } self.failUnless(result.matches(obj)) obj = { 'fn': ['test'], 'sn': ['person'] } self.failUnless(result.matches(obj)) obj = { 'fn': ['demo'], 'sn': ['user'] } self.failIf(result.matches(obj))
def test_parse_with_simple_filter__exists(self): result = backend._Parser('(cn=*)') obj = { 'cn': ['testuser'] } self.failUnless(result.matches(obj)) obj = { 'cn': ['testuser1'] } self.failUnless(result.matches(obj)) obj = { 'notcn': ['testuser'] } self.failIf(result.matches(obj))
def test_parse_with_simple_filter__not_exact(self): result = backend._Parser('(cn=test*)') obj = {'cn': ['testuser']} self.failUnless(result.matches(obj)) obj = {'cn': ['xtestuser']} self.failIf(result.matches(obj)) result = backend._Parser('(cn=*user)') obj = {'cn': ['testuser']} self.failUnless(result.matches(obj)) obj = {'cn': ['testuser1']} self.failIf(result.matches(obj)) result = backend._Parser('(cn=*stus*)') obj = {'cn': ['testuser']} self.failUnless(result.matches(obj)) obj = {'cn': ['testxuser']} self.failIf(result.matches(obj))
def test_parse_with_simple_filter__not_exact(self): result = backend._Parser('(cn=test*)') obj = { 'cn': ['testuser'] } self.failUnless(result.matches(obj)) obj = { 'cn': ['xtestuser'] } self.failIf(result.matches(obj)) result = backend._Parser('(cn=*user)') obj = { 'cn': ['testuser'] } self.failUnless(result.matches(obj)) obj = { 'cn': ['testuser1'] } self.failIf(result.matches(obj)) result = backend._Parser('(cn=*stus*)') obj = { 'cn': ['testuser'] } self.failUnless(result.matches(obj)) obj = { 'cn': ['testxuser'] } self.failIf(result.matches(obj))
def test_parse_with_OR_filter__exact(self): result = backend._Parser('(|(fn=test)(sn=user))') obj = {'fn': ['test'], 'sn': ['user']} self.failUnless(result.matches(obj)) obj = {'fn': ['test'], 'sn': ['person']} self.failUnless(result.matches(obj)) obj = {'fn': ['demo'], 'sn': ['user']} self.failUnless(result.matches(obj)) obj = {'fn': ['practice'], 'sn': ['guy']} self.failIf(result.matches(obj))
def test_parse_with_OR_filter__exact(self): result = backend._Parser('(|(fn=test)(sn=user))') obj = { 'fn': ['test'], 'sn': ['user'] } self.failUnless(result.matches(obj)) obj = { 'fn': ['test'], 'sn': ['person'] } self.failUnless(result.matches(obj)) obj = { 'fn': ['demo'], 'sn': ['user'] } self.failUnless(result.matches(obj)) obj = { 'fn': ['practice'], 'sn': ['guy'] } self.failIf(result.matches(obj))