X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=ldapdb%2Ftests.py;h=de13b9d97303357a4583617475cafd04d9e8cd21;hb=ab216ac000ca0b6aeea64d9ce112395bbb7962d5;hp=124f628e39b4f52da07d3e243da41249fda2ab58;hpb=d550eee66cb832f9d906d67b22967f802f41615f;p=matthijs%2Fupstream%2Fdjango-ldapdb.git diff --git a/ldapdb/tests.py b/ldapdb/tests.py index 124f628..de13b9d 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 @@ -21,7 +21,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 import escape_ldap_filter from ldapdb.models.fields import CharField, IntegerField, ListField from ldapdb.models.query import WhereNode @@ -60,9 +60,17 @@ class WhereTestCase(TestCase): def test_integer_field(self): where = WhereNode() - where.add((Constraint("uid", "uid", CharField()), 'exact', 1), AND) + where.add((Constraint("uid", "uid", IntegerField()), 'exact', 1), AND) self.assertEquals(where.as_sql(), "(uid=1)") + where = WhereNode() + where.add((Constraint("uid", "uid", IntegerField()), 'gte', 1), AND) + self.assertEquals(where.as_sql(), "(uid>=1)") + + where = WhereNode() + where.add((Constraint("uid", "uid", IntegerField()), 'lte', 1), AND) + self.assertEquals(where.as_sql(), "(uid<=1)") + def test_and(self): where = WhereNode() where.add((Constraint("cn", "cn", CharField()), 'exact', "foo"), AND)