From: jlaine Date: Mon, 11 Apr 2011 11:22:02 +0000 (+0000) Subject: partially fix tests X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=8ce1036ed9e6126d584ba22bc4a5b869eb8b67ad;p=matthijs%2Fupstream%2Fdjango-ldapdb.git partially fix tests git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@1029 e071eeec-0327-468d-9b6a-08194a12b294 --- diff --git a/examples/tests.py b/examples/tests.py index 60f2abc..1b4a42c 100644 --- a/examples/tests.py +++ b/examples/tests.py @@ -37,6 +37,7 @@ from django.test import TestCase import ldap import ldapdb +from ldapdb.backends.ldap.compiler import query_as_ldap from examples.models import LdapUser, LdapGroup class BaseTestCase(TestCase): @@ -101,35 +102,35 @@ class GroupTestCase(BaseTestCase): def test_ldap_filter(self): # single filter qs = LdapGroup.objects.filter(name='foogroup') - self.assertEquals(qs.query._ldap_filter(), '(&(objectClass=posixGroup)(cn=foogroup))') + self.assertEquals(query_as_ldap(qs.query), '(&(objectClass=posixGroup)(cn=foogroup))') qs = LdapGroup.objects.filter(Q(name='foogroup')) - self.assertEquals(qs.query._ldap_filter(), '(&(objectClass=posixGroup)(cn=foogroup))') + self.assertEquals(query_as_ldap(qs.query), '(&(objectClass=posixGroup)(cn=foogroup))') # AND filter qs = LdapGroup.objects.filter(gid=1000, name='foogroup') - self.assertEquals(qs.query._ldap_filter(), '(&(objectClass=posixGroup)(&(gidNumber=1000)(cn=foogroup)))') + self.assertEquals(query_as_ldap(qs.query), '(&(objectClass=posixGroup)(&(gidNumber=1000)(cn=foogroup)))') qs = LdapGroup.objects.filter(Q(gid=1000) & Q(name='foogroup')) - self.assertEquals(qs.query._ldap_filter(), '(&(objectClass=posixGroup)(&(gidNumber=1000)(cn=foogroup)))') + self.assertEquals(query_as_ldap(qs.query), '(&(objectClass=posixGroup)(&(gidNumber=1000)(cn=foogroup)))') # OR filter qs = LdapGroup.objects.filter(Q(gid=1000) | Q(name='foogroup')) - self.assertEquals(qs.query._ldap_filter(), '(&(objectClass=posixGroup)(|(gidNumber=1000)(cn=foogroup)))') + self.assertEquals(query_as_ldap(qs.query), '(&(objectClass=posixGroup)(|(gidNumber=1000)(cn=foogroup)))') # single exclusion qs = LdapGroup.objects.exclude(name='foogroup') - self.assertEquals(qs.query._ldap_filter(), '(&(objectClass=posixGroup)(!(cn=foogroup)))') + self.assertEquals(query_as_ldap(qs.query), '(&(objectClass=posixGroup)(!(cn=foogroup)))') qs = LdapGroup.objects.filter(~Q(name='foogroup')) - self.assertEquals(qs.query._ldap_filter(), '(&(objectClass=posixGroup)(!(cn=foogroup)))') + self.assertEquals(query_as_ldap(qs.query), '(&(objectClass=posixGroup)(!(cn=foogroup)))') # multiple exclusion qs = LdapGroup.objects.exclude(name='foogroup', gid=1000) - self.assertEquals(qs.query._ldap_filter(), '(&(objectClass=posixGroup)(!(&(gidNumber=1000)(cn=foogroup))))') + self.assertEquals(query_as_ldap(qs.query), '(&(objectClass=posixGroup)(!(&(gidNumber=1000)(cn=foogroup))))') qs = LdapGroup.objects.filter(name='foogroup').exclude(gid=1000) - self.assertEquals(qs.query._ldap_filter(), '(&(objectClass=posixGroup)(&(cn=foogroup)(!(gidNumber=1000))))') + self.assertEquals(query_as_ldap(qs.query), '(&(objectClass=posixGroup)(&(cn=foogroup)(!(gidNumber=1000))))') def test_filter(self): qs = LdapGroup.objects.filter(name='foogroup')