Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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))
Exemplo n.º 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))