client = <FlaskClient <Flask 'swh.graphql.tests.conftest'>>
def test_query_cost_origin(client):
query_str = """
{
origins(first: 10) {
nodes {
url
latestVisit {
date
}
visits(first: 5) {
nodes {
date
status {
nodes {
date
}
}
}
}
snapshots(first: 5) {
nodes {
swhid
}
}
}
}
}
"""
# Total cost here is 170
# 10 (origin) + 10 (latestVisit) + 10*5 (visits) + 10 * 5 * 3 (status) +
# 10 * 5*2 (snapshots) = 320
errors = utils.get_error_response(client, query_str)
> assert (
"The query exceeds the maximum cost of 100. Actual cost is 320"
in errors[0]["message"]
)
E assert 'The query exceeds the maximum cost of 100. Actual cost is 320' in "Cannot query field 'status' on type 'Visit'. Did you mean 'statuses'?"
.tox/py3/lib/python3.7/site-packages/swh/graphql/tests/functional/test_query_cost.py:73: AssertionError
TEST RESULT
TEST RESULT
- Run At
- Sep 27 2022, 3:40 PM