X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=ldapdb%2Ftests.py;h=4b6f7f15216ea28b36d1fee8165bc9421552c245;hb=4a1abcd053ba73b2c7e2db1068eb400468906e1a;hp=fdcba594b9e1a56ac18067c45a42b017006bc1fd;hpb=c92a7be6f574fceac92e13b5805aebdbc31c281e;p=matthijs%2Fupstream%2Fdjango-ldapdb.git diff --git a/ldapdb/tests.py b/ldapdb/tests.py index fdcba59..4b6f7f1 100644 --- a/ldapdb/tests.py +++ b/ldapdb/tests.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # django-ldapdb -# Copyright (C) 2009 Bolloré telecom +# Copyright (C) 2009-2010 Bolloré telecom # See AUTHORS file for a full list of contributors. # # This program is free software: you can redistribute it and/or modify @@ -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)