improve test coverage
authorjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 24 May 2010 08:40:47 +0000 (08:40 +0000)
committerjlaine <jlaine@e071eeec-0327-468d-9b6a-08194a12b294>
Mon, 24 May 2010 08:40:47 +0000 (08:40 +0000)
git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@865 e071eeec-0327-468d-9b6a-08194a12b294

ldapdb/tests.py

index b102a3ef2670cf096575b30800a0aedfb60236c9..f9c4b1674a3df4a74143d75268d79b19fd3d76a3 100644 (file)
@@ -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)