def test_totals(connection, query_totals):
"""
Test `get_object` func
"""
totals, expected = query_totals
if isinstance(totals, str):
totals = json.loads(totals, object_pairs_hook=OrderedDict)
if isinstance(expected, str):
expected = json.loads(expected)
c = CollectionResource(objects_class=Model, connection=connection)
query_obj = c._build_total_expressions(Search(using=connection).doc_type(Model), totals)
assert query_obj.to_dict() == expected
评论列表
文章目录