Example #1
0
 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))
Example #2
0
 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))
Example #3
0
 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))
Example #4
0
 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))
Example #5
0
 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))
Example #6
0
 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))
Example #7
0
    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))
Example #8
0
 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))
Example #9
0
 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))
Example #10
0
 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))