def test_multiple(self): f = {"age__eq": 55, "surname__like": "%joe%"} filters = qsqla.build_filters(f) expected = [{ "name": "surname", "op": "like", "val": "%joe%" }, { "name": "age", "op": "eq", "val": 55 }] self.assertEquals(sorted(filters, key=itemgetter("name")), sorted(expected, key=itemgetter("name")))
def test_one_with_operator(self): f = {"age__gt": 55} filters = qsqla.build_filters(f) self.assertEquals(filters, [{"name": "age", "op": "gt", "val": 55}])
def test_empty(self): f = {} filters = qsqla.build_filters(f) self.assertEquals(filters, [])