- where.add((Constraint("cn", "cn", None), 'exact', "(test)"), AND)
- self.assertEquals(where.as_sql(), "(cn=\\28test\\29)")
+ 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)
+ 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_list_field_contains(self):
+ where = WhereNode()
+ where.add((Constraint("memberUid", "memberUid", ListField()), 'contains', 'foouser'), AND)
+ self.assertEquals(where.as_sql(), "(memberUid=foouser)")
+
+ where = WhereNode()
+ where.add((Constraint("memberUid", "memberUid", ListField()), 'contains', '(foouser)'), AND)
+ self.assertEquals(where.as_sql(), "(memberUid=\\28foouser\\29)")