From: jlaine Date: Mon, 24 May 2010 06:47:24 +0000 (+0000) Subject: refactor tests X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=d550eee66cb832f9d906d67b22967f802f41615f;p=matthijs%2Fupstream%2Fdjango-ldapdb.git refactor tests git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@854 e071eeec-0327-468d-9b6a-08194a12b294 --- diff --git a/ldapdb/tests.py b/ldapdb/tests.py index fdcba59..124f628 100644 --- a/ldapdb/tests.py +++ b/ldapdb/tests.py @@ -22,7 +22,7 @@ from django.test import TestCase from django.db.models.sql.where import Constraint, AND, OR from ldapdb.models.query import escape_ldap_filter -from ldapdb.models.fields import CharField, IntegerField +from ldapdb.models.fields import CharField, IntegerField, ListField from ldapdb.models.query import WhereNode class WhereTestCase(TestCase): @@ -38,6 +38,10 @@ class WhereTestCase(TestCase): where.add((Constraint("cn", "cn", CharField()), 'exact', "test"), AND) self.assertEquals(where.as_sql(), "(cn=test)") + where = WhereNode() + where.add((Constraint("cn", "cn", CharField()), 'exact', "(test)"), AND) + self.assertEquals(where.as_sql(), "(cn=\\28test\\29)") + where = WhereNode() where.add((Constraint("cn", "cn", CharField()), 'startswith', "test"), AND) self.assertEquals(where.as_sql(), "(cn=test*)") @@ -59,11 +63,6 @@ class WhereTestCase(TestCase): where.add((Constraint("uid", "uid", CharField()), 'exact', 1), AND) self.assertEquals(where.as_sql(), "(uid=1)") - def test_escaped(self): - where = WhereNode() - where.add((Constraint("cn", "cn", CharField()), 'exact', "(test)"), AND) - self.assertEquals(where.as_sql(), "(cn=\\28test\\29)") - def test_and(self): where = WhereNode() where.add((Constraint("cn", "cn", CharField()), 'exact', "foo"), AND)