From: jlaine Date: Mon, 24 May 2010 08:40:47 +0000 (+0000) Subject: improve test coverage X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=685bca7c33547937fec1ecdb477df10ca9ef0572;p=matthijs%2Fupstream%2Fdjango-ldapdb.git improve test coverage git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@865 e071eeec-0327-468d-9b6a-08194a12b294 --- diff --git a/ldapdb/tests.py b/ldapdb/tests.py index b102a3e..f9c4b16 100644 --- a/ldapdb/tests.py +++ b/ldapdb/tests.py @@ -56,15 +56,28 @@ class WhereTestCase(TestCase): where.add((Constraint("cn", "cn", CharField()), 'startswith', "test"), AND) self.assertEquals(where.as_sql(), "(cn=test*)") + where = WhereNode() + where.add((Constraint("cn", "cn", CharField()), 'startswith', "te*st"), AND) + self.assertEquals(where.as_sql(), "(cn=te\\2ast*)") + + def test_char_field_endswith(self): where = WhereNode() where.add((Constraint("cn", "cn", CharField()), 'endswith', "test"), AND) self.assertEquals(where.as_sql(), "(cn=*test)") + where = WhereNode() + where.add((Constraint("cn", "cn", CharField()), 'endswith', "te*st"), AND) + self.assertEquals(where.as_sql(), "(cn=*te\\2ast)") + def test_char_field_contains(self): where = WhereNode() where.add((Constraint("cn", "cn", CharField()), 'contains', "test"), AND) self.assertEquals(where.as_sql(), "(cn=*test*)") + where = WhereNode() + where.add((Constraint("cn", "cn", CharField()), 'contains', "te*st"), AND) + self.assertEquals(where.as_sql(), "(cn=*te\\2ast*)") + def test_integer_field(self): where = WhereNode() where.add((Constraint("uid", "uid", IntegerField()), 'exact', 1), AND)