From 685bca7c33547937fec1ecdb477df10ca9ef0572 Mon Sep 17 00:00:00 2001 From: jlaine Date: Mon, 24 May 2010 08:40:47 +0000 Subject: [PATCH] improve test coverage git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@865 e071eeec-0327-468d-9b6a-08194a12b294 --- ldapdb/tests.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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) -- 2.30.2