Ejemplo n.º 1
0
def test_ancestors_kind_lookup(foo_model: Model, graph_db: GraphDB) -> None:
    # 1234 is coerced to a string
    query = "ancestors.account.reported.name==1234"
    assert to_query(graph_db, QueryModel(parse_query(query),
                                         foo_model))[1] == {
                                             "b0": "1234"
                                         }
Ejemplo n.º 2
0
 def query_string(query: str) -> str:
     query_str, _ = to_query(graph_db,
                             QueryModel(parse_query(query), foo_model))
     return query_str
Ejemplo n.º 3
0
 def check_sort_in_query(q: Query, expected_sort: str) -> None:
     query_str, _ = to_query(graph_db, QueryModel(q, foo_model))
     assert f"SORT {expected_sort}" in query_str, f"Expected {expected_sort} in {query_str}"
Ejemplo n.º 4
0
def test_escape_property_path(foo_model: Model, graph_db: GraphDB) -> None:
    raw = "metadata.replace.with.filter.sort.bla==true"
    query = to_query(graph_db, QueryModel(parse_query(raw), foo_model))[0]
    # aql keywords are escaped with backslashes
    assert "m0.metadata.`replace`.`with`.`filter`.`sort`.bla" in query